Completed
Push — master ( d6a494...e1144e )
by Дмитрий
11s
created

tests/PHPSA/Compiler/Expression/IssetTest.php (9 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
namespace Tests\PHPSA\Expression;
4
5
use PhpParser\Node;
6
use PHPSA\CompiledExpression;
7
use PHPSA\Compiler\Expression;
8
use PHPSA\Variable;
9
10
class IssetTest extends \Tests\PHPSA\TestCase
11
{
12
    public function testIssetVarInt()
13
    {
14
        $this->markTestSkipped('Unsupported now, because it is not possible to get good results');
15
16
        $context = $this->getContext();
17
        $context->addVariable(new Variable("name", 10, CompiledExpression::INTEGER));
18
19
        $baseExpression = new Node\Expr\Isset_([
20
            new Node\Expr\Variable(
21
                new Node\Name("name")
22
            )
23
        ]);
24
        $compiledExpression = $this->compileExpression($baseExpression, $context);
25
26
        parent::assertInstanceOfCompiledExpression($compiledExpression);
0 ignored issues
show
Comprehensibility Bug introduced by
It seems like you call parent on a different method (assertInstanceOfCompiledExpression() instead of testIssetVarInt()). Are you sure this is correct? If so, you might want to change this to $this->assertInstanceOfCompiledExpression().

This check looks for a call to a parent method whose name is different than the method from which it is called.

Consider the following code:

class Daddy
{
    protected function getFirstName()
    {
        return "Eidur";
    }

    protected function getSurName()
    {
        return "Gudjohnsen";
    }
}

class Son
{
    public function getFirstName()
    {
        return parent::getSurname();
    }
}

The getFirstName() method in the Son calls the wrong method in the parent class.

Loading history...
27
        parent::assertSame(CompiledExpression::BOOLEAN, $compiledExpression->getType());
0 ignored issues
show
Comprehensibility Bug introduced by
It seems like you call parent on a different method (assertSame() instead of testIssetVarInt()). Are you sure this is correct? If so, you might want to change this to $this->assertSame().

This check looks for a call to a parent method whose name is different than the method from which it is called.

Consider the following code:

class Daddy
{
    protected function getFirstName()
    {
        return "Eidur";
    }

    protected function getSurName()
    {
        return "Gudjohnsen";
    }
}

class Son
{
    public function getFirstName()
    {
        return parent::getSurname();
    }
}

The getFirstName() method in the Son calls the wrong method in the parent class.

Loading history...
28
        parent::assertTrue($compiledExpression->getValue());
0 ignored issues
show
Comprehensibility Bug introduced by
It seems like you call parent on a different method (assertTrue() instead of testIssetVarInt()). Are you sure this is correct? If so, you might want to change this to $this->assertTrue().

This check looks for a call to a parent method whose name is different than the method from which it is called.

Consider the following code:

class Daddy
{
    protected function getFirstName()
    {
        return "Eidur";
    }

    protected function getSurName()
    {
        return "Gudjohnsen";
    }
}

class Son
{
    public function getFirstName()
    {
        return parent::getSurname();
    }
}

The getFirstName() method in the Son calls the wrong method in the parent class.

Loading history...
29
    }
30
31
    public function testIssetVarNull()
32
    {
33
        $this->markTestSkipped('Unsupported now, because it is not possible to get good results');
34
35
        $context = $this->getContext();
36
        $context->addVariable(new Variable("name", null, CompiledExpression::NULL));
37
38
        $baseExpression = new Node\Expr\Isset_([
39
            new Node\Expr\Variable(
40
                new Node\Name("name")
41
            )
42
        ]);
43
        $compiledExpression = $this->compileExpression($baseExpression, $context);
44
45
        parent::assertInstanceOfCompiledExpression($compiledExpression);
0 ignored issues
show
Comprehensibility Bug introduced by
It seems like you call parent on a different method (assertInstanceOfCompiledExpression() instead of testIssetVarNull()). Are you sure this is correct? If so, you might want to change this to $this->assertInstanceOfCompiledExpression().

This check looks for a call to a parent method whose name is different than the method from which it is called.

Consider the following code:

class Daddy
{
    protected function getFirstName()
    {
        return "Eidur";
    }

    protected function getSurName()
    {
        return "Gudjohnsen";
    }
}

class Son
{
    public function getFirstName()
    {
        return parent::getSurname();
    }
}

The getFirstName() method in the Son calls the wrong method in the parent class.

Loading history...
46
        parent::assertSame(CompiledExpression::BOOLEAN, $compiledExpression->getType());
0 ignored issues
show
Comprehensibility Bug introduced by
It seems like you call parent on a different method (assertSame() instead of testIssetVarNull()). Are you sure this is correct? If so, you might want to change this to $this->assertSame().

This check looks for a call to a parent method whose name is different than the method from which it is called.

Consider the following code:

class Daddy
{
    protected function getFirstName()
    {
        return "Eidur";
    }

    protected function getSurName()
    {
        return "Gudjohnsen";
    }
}

class Son
{
    public function getFirstName()
    {
        return parent::getSurname();
    }
}

The getFirstName() method in the Son calls the wrong method in the parent class.

Loading history...
47
        parent::assertFalse($compiledExpression->getValue());
0 ignored issues
show
Comprehensibility Bug introduced by
It seems like you call parent on a different method (assertFalse() instead of testIssetVarNull()). Are you sure this is correct? If so, you might want to change this to $this->assertFalse().

This check looks for a call to a parent method whose name is different than the method from which it is called.

Consider the following code:

class Daddy
{
    protected function getFirstName()
    {
        return "Eidur";
    }

    protected function getSurName()
    {
        return "Gudjohnsen";
    }
}

class Son
{
    public function getFirstName()
    {
        return parent::getSurname();
    }
}

The getFirstName() method in the Son calls the wrong method in the parent class.

Loading history...
48
    }
49
50
    public function testIssetVarNotExisting()
51
    {
52
        $this->markTestSkipped('Unsupported now, because it is not possible to get good results');
53
54
        $context = $this->getContext();
55
56
        $baseExpression = new Node\Expr\Isset_([
57
            new Node\Expr\Variable(
58
                new Node\Name("name")
59
            )
60
        ]);
61
        $compiledExpression = $this->compileExpression($baseExpression, $context);
62
63
        parent::assertInstanceOfCompiledExpression($compiledExpression);
0 ignored issues
show
Comprehensibility Bug introduced by
It seems like you call parent on a different method (assertInstanceOfCompiledExpression() instead of testIssetVarNotExisting()). Are you sure this is correct? If so, you might want to change this to $this->assertInstanceOfCompiledExpression().

This check looks for a call to a parent method whose name is different than the method from which it is called.

Consider the following code:

class Daddy
{
    protected function getFirstName()
    {
        return "Eidur";
    }

    protected function getSurName()
    {
        return "Gudjohnsen";
    }
}

class Son
{
    public function getFirstName()
    {
        return parent::getSurname();
    }
}

The getFirstName() method in the Son calls the wrong method in the parent class.

Loading history...
64
        parent::assertSame(CompiledExpression::BOOLEAN, $compiledExpression->getType());
0 ignored issues
show
Comprehensibility Bug introduced by
It seems like you call parent on a different method (assertSame() instead of testIssetVarNotExisting()). Are you sure this is correct? If so, you might want to change this to $this->assertSame().

This check looks for a call to a parent method whose name is different than the method from which it is called.

Consider the following code:

class Daddy
{
    protected function getFirstName()
    {
        return "Eidur";
    }

    protected function getSurName()
    {
        return "Gudjohnsen";
    }
}

class Son
{
    public function getFirstName()
    {
        return parent::getSurname();
    }
}

The getFirstName() method in the Son calls the wrong method in the parent class.

Loading history...
65
        parent::assertFalse($compiledExpression->getValue());
0 ignored issues
show
Comprehensibility Bug introduced by
It seems like you call parent on a different method (assertFalse() instead of testIssetVarNotExisting()). Are you sure this is correct? If so, you might want to change this to $this->assertFalse().

This check looks for a call to a parent method whose name is different than the method from which it is called.

Consider the following code:

class Daddy
{
    protected function getFirstName()
    {
        return "Eidur";
    }

    protected function getSurName()
    {
        return "Gudjohnsen";
    }
}

class Son
{
    public function getFirstName()
    {
        return parent::getSurname();
    }
}

The getFirstName() method in the Son calls the wrong method in the parent class.

Loading history...
66
    }
67
}
68