StringLiteralTests::fromNative()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
/**
4
 * This file is part of the Cubiche package.
5
 *
6
 * Copyright (c) Cubiche
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
namespace Cubiche\Domain\System\Tests\Units;
12
13
use Cubiche\Domain\Model\Tests\Units\NativeValueObjectTestCase;
14
use Cubiche\Domain\System\StringLiteral;
15
16
/**
17
 * StringLiteralTests class.
18
 *
19
 * @author Ivannis Suárez Jerez <[email protected]>
20
 */
21
class StringLiteralTests extends NativeValueObjectTestCase
22
{
23
    /**
24
     * {@inheritdoc}
25
     */
26
    protected function randomNativeValue()
27
    {
28
        return uniqid();
29
    }
30
31
    /**
32
     * {@inheritdoc}
33
     */
34
    protected function invalidNativeValue()
35
    {
36
        return 3.14;
37
    }
38
39
    /**
40
     * {@inheritdoc}
41
     */
42
    protected function uniqueNativeValue()
43
    {
44
        return uniqid();
45
    }
46
47
    /**
48
     * {@inheritdoc}
49
     */
50
    protected function fromNative($value)
51
    {
52
        return StringLiteral::fromNative($value);
53
    }
54
55
    /**
56
     * Test isEmpty method.
57
     */
58 View Code Duplication
    public function testIsEmpty()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
59
    {
60
        $this
61
            ->given(
62
                $literal = $this->fromNative($this->randomNativeValue()),
63
                $emptyLiteral = $this->fromNative('')
64
            )
65
            ->then
66
                ->boolean($literal->isEmpty())
67
                    ->isFalse()
68
                ->boolean($emptyLiteral->isEmpty())
69
                    ->isTrue()
70
        ;
71
    }
72
}
73