Passed
Push — 7.x ( 3ebc9f...4982c4 )
by Adrien
08:52
created

SplStringTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Importance

Changes 2
Bugs 1 Features 0
Metric Value
eloc 13
c 2
b 1
f 0
dl 0
loc 35
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testConcatenate() 0 10 1
A test() 0 9 1
1
<?php
2
3
/**
4
 * Part of SplTypes package.
5
 *
6
 * (c) Adrien Loyant <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
declare(strict_types=1);
13
14
namespace Ducks\Component\SplTypes\Tests\phpunit;
15
16
use Ducks\Component\SplTypes\SplString as DuckString;
17
use PHPUnit\Framework\TestCase;
18
19
class SplStringTest extends TestCase
20
{
21
    /**
22
     * Unit test.
23
     *
24
     * @return void
25
     */
26
    public function test(): void
27
    {
28
        $instance = new DuckString();
29
        $this->assertSame('', $instance());
30
        unset($instance);
31
32
        $instance = new DuckString('test');
33
        $this->assertSame('test', $instance());
34
        unset($instance);
35
    }
36
37
    /**
38
     * Unit test.
39
     *
40
     * @return void
41
     *
42
     * @psalm-suppress UnsupportedReferenceUsage
43
     */
44
    public function testConcatenate(): void
45
    {
46
        $instance = new DuckString('hello ');
47
48
        $value = &$instance();
49
        $value .= 'world';
50
51
        $this->assertSame('hello world', $value);
52
        $this->assertSame('hello world', $instance());
53
        unset($instance);
54
    }
55
}
56