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

AbstractUnaryOp   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 24
c 0
b 0
f 0
rs 10
wmc 1
lcom 1
cbo 1

2 Methods

Rating   Name   Duplication   Size   Complexity  
buildExpression() 0 1 ?
A testUnexpectedType() 0 11 1
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