Pinq\Tests\Integration\Queries\Functions\FunctionTest::testFunctionWithReturnStatement PHP Метод

testFunctionWithReturnStatement() публичный Метод

    public function testFunctionWithReturnStatement()
    {
        $function = $this->functionWithReturnStatement();
        $this->assertSame('', $function->getCallableId());
        $this->assertSame(1, $function->getParameters()->count());
        $this->assertEquals([O\Expression::parameter('foo')], $function->getParameters()->getAll());
        $this->assertEquals(['param' => 'scope'], $function->getParameterScopedVariableMap());
        $this->assertEquals(['', 'param'], $function->getParameterIds());
        $this->assertSame(true, $function->hasScopeType());
        $this->assertSame(__CLASS__, $function->getScopeType());
        $this->assertSame(true, $function->hasNamespace());
        $this->assertSame(__NAMESPACE__, $function->getNamespace());
        $this->assertSame(4, $function->countBodyExpressions());
        $this->assertSame(2, $function->countBodyExpressionsUntilReturn());
        $this->assertEquals([O\Expression::value('before'), O\Expression::returnExpression(O\Expression::value('return')), O\Expression::value('after'), O\Expression::functionCall(O\Expression::value('boom'))], $function->getBodyExpressions());
        $this->assertEquals([O\Expression::value('before'), O\Expression::returnExpression(O\Expression::value('return'))], $function->getBodyExpressionsUntilReturn());
        $this->assertEquals(new O\EvaluationContext(__NAMESPACE__, __CLASS__, null, ['scope' => 'value']), $function->getEvaluationContextFactory()->getEvaluationContext(new ResolvedParameterRegistry(['param' => 'value'])));
    }