Test Setup Failed
Push — master ( 68b56a...635587 )
by DeGracia
02:56 queued 01:16
created

ScalarTests::freeze_integer()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 7
c 0
b 0
f 0
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
namespace DeGraciaMathieu\FreezeMyScalar\Tests;
4
5
use PHPUnit\Framework\TestCase;
6
use DeGraciaMathieu\FreezeMyScalar\FreezeString;
7
use DeGraciaMathieu\FreezeMyScalar\FreezeInteger;
8
use DeGraciaMathieu\FreezeMyScalar\Contracts\Scalar;
9
use DeGraciaMathieu\FreezeMyScalar\Exceptions\UnexpectedValueException;
10
11
class ScalarTests extends TestCase 
12
{
13
    /** 
14
     * @test
15
     */
16
    public function freeze_integer()
17
    {
18
        $scalar = new FreezeInteger(10);
19
20
        $this->isInstanceOf(FreezeInteger::class, $scalar);
0 ignored issues
show
Unused Code introduced by
The call to PHPUnit\Framework\Assert::isInstanceOf() has too many arguments starting with $scalar. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

20
        $this->/** @scrutinizer ignore-call */ 
21
               isInstanceOf(FreezeInteger::class, $scalar);

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.

Loading history...
21
        $this->isInstanceOf(Scalar::class, $scalar);
22
        $this->assertEquals($scalar->content(), 10);
23
    }
24
25
    /** 
26
     * @test
27
     */
28
    public function string_integer()
29
    {
30
        $scalar = new FreezeString('string');
31
32
        $this->isInstanceOf(FreezeString::class, $scalar);
0 ignored issues
show
Unused Code introduced by
The call to PHPUnit\Framework\Assert::isInstanceOf() has too many arguments starting with $scalar. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

32
        $this->/** @scrutinizer ignore-call */ 
33
               isInstanceOf(FreezeString::class, $scalar);

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.

Loading history...
33
        $this->isInstanceOf(Scalar::class, $scalar);
34
        $this->assertEquals($scalar->content(), 'string');
35
    }  
36
37
    /** 
38
     * @test
39
     */
40
    public function unexpected_value()
41
    {
42
        $this->expectException(UnexpectedValueException::class);
43
44
        new FreezeString(10);
45
    }   
46
}
47