ScalarTests::unexpected_value()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 10
c 0
b 0
f 0
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 View Code Duplication
    public function freeze_integer()
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...
17
    {
18
        $scalar = new FreezeInteger(10);
19
20
        $this->isInstanceOf(FreezeInteger::class, $scalar);
0 ignored issues
show
Unused Code introduced by
The call to ScalarTests::isInstanceOf() has too many arguments starting with $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.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
21
        $this->isInstanceOf(Scalar::class, $scalar);
0 ignored issues
show
Unused Code introduced by
The call to ScalarTests::isInstanceOf() has too many arguments starting with $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.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
22
        $this->assertEquals($scalar->content(), 10);
23
    }
24
25
    /** 
26
     * @test
27
     */
28 View Code Duplication
    public function string_integer()
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...
29
    {
30
        $scalar = new FreezeString('string');
31
32
        $this->isInstanceOf(FreezeString::class, $scalar);
0 ignored issues
show
Unused Code introduced by
The call to ScalarTests::isInstanceOf() has too many arguments starting with $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.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
33
        $this->isInstanceOf(Scalar::class, $scalar);
0 ignored issues
show
Unused Code introduced by
The call to ScalarTests::isInstanceOf() has too many arguments starting with $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.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
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