Completed
Pull Request — master (#304)
by Enrico
03:09
created

AbstractUnaryOp::testUnexpectedType()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
nc 1
dl 0
loc 11
c 0
b 0
f 0
cc 1
eloc 7
nop 0
rs 9.4285
1
<?php
2
3
namespace Tests\PHPSA\Compiler\Expression;
4
5
use PhpParser\Node;
6
use PHPSA\CompiledExpression;
7
use PHPSA\Compiler\Expression;
8
9
abstract class AbstractUnaryOp extends \Tests\PHPSA\TestCase
10
{
11
    /**
12
     * @param $a
13
     * @return Node\Expr
14
     */
15
    abstract protected function buildExpression($a);
16
17
18
    /**
19
     * Tests $operator {expr::UNKNOWN}
20
     */
21
    public function testUnexpectedType()
22
    {
23
        $baseExpression = $this->buildExpression(
24
            $this->newFakeScalarExpr()
25
        );
26
        $compiledExpression = $this->compileExpression($baseExpression);
27
28
        $this->assertInstanceOfCompiledExpression($compiledExpression);
29
        $this->assertSame(CompiledExpression::UNKNOWN, $compiledExpression->getType());
30
        $this->assertSame(null, $compiledExpression->getValue());
31
    }
32
}
33