/** * Test if the method `isShorthandAllowed` returns false. */ public function testIsShorthandAllowedReturnsFalse() { $operator = new TernaryOperator(1, 2, 10, TernaryOperator::RIGHT, false, function () { }); $this->assertFalse($operator->isShorthandAllowed()); }
/** * Test if the `isTernary` method returns true if the given token is the `else` token of a ternary operator. */ public function testIsTernaryReturnsTrueForElseToken() { $operator = new TernaryOperator(1, 2, 10, TernaryOperator::RIGHT, true, function () { }); $token = new Token($operator->getIfCode(), ':', 2); $table = new OperatorTable(); $table->addOperator($operator); $this->assertTrue($table->isTernary($token)); }