assertInstanceOf(FilterExpression::class, $attributeFilterExpression); $this->assertInstanceOf(AttributeExpression::class, $attributeFilterExpression); $this->assertEquals("userName", $attributeFilterExpression->getAttributePath()); $this->assertEquals(AttributeOperator::OP_EQ, $attributeFilterExpression->getCompareOperator()); $this->assertEquals("sometestusername", $attributeFilterExpression->getComparisonValue()); // Test a "pr" filter expression $filterString = "meta.created pr"; $attributeFilterExpression = FilterParser::parseFilterExpression($filterString); $this->assertInstanceOf(FilterExpression::class, $attributeFilterExpression); $this->assertInstanceOf(AttributeExpression::class, $attributeFilterExpression); $this->assertEquals("meta.created", $attributeFilterExpression->getAttributePath()); $this->assertEquals(AttributeOperator::OP_PR, $attributeFilterExpression->getCompareOperator()); $this->assertNull($attributeFilterExpression->getComparisonValue()); } public function testParseTooShortFilterExpression() { $this->expectException(FilterException::class); $this->expectExceptionMessage("Incorrectly formatted AttributeExpression"); $filterString = "somestring"; $parsedFilterExpression = FilterParser::parseFilterExpression($filterString); } public function testParseTooLongFilterExpression() { $this->expectException(FilterException::class); $this->expectExceptionMessage("Incorrectly formatted AttributeExpression"); $filterString = "userName eq some value"; $parsedFilterExpression = FilterParser::parseFilterExpression($filterString); } }