Passed
Push — master ( 10b09c...54e166 )
by Schlaefer
04:38
created

PhileToPsr16CacheAdapterTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 1
c 1
b 0
f 1
lcom 0
cbo 4
dl 0
loc 17
ccs 10
cts 10
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A testSlug() 0 14 1
1
<?php
2
3
namespace Phile\Plugin\Phile\PhpFastCache\Tests;
4
5
use Phile\Plugin\Phile\PhpFastCache\PhileToPsr16CacheAdapter;
6
use phpFastCache\Helper\Psr16Adapter;
7
use Phile\Test\TestCase;
8
9
class PhileToPsr16CacheAdapterTest extends TestCase
10
{
11 1
    public function testSlug()
12
    {
13 1
        $this->createPhileCore()->bootstrap();
14
15 1
        $psr16Cache = new Psr16Adapter('memstatic');
16 1
        $adapter = new PhileToPsr16CacheAdapter($psr16Cache);
17
18 1
        $adapter->set("{}()\/:@", 'foo');
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal {}()\/:@ does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
19 1
        $this->assertSame('foo', $adapter->get("{}()\/:@"));
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal {}()\/:@ does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
20
21 1
        $adapter->set('}foo', 'bar');
22 1
        $adapter->set('{foo', 'baz');
23 1
        $this->assertSame('bar', $adapter->get('}foo'));
24 1
    }
25
}
26