public function testWalkAndCompositeExpression() { $cb = new CriteriaBuilder(); $expr = $this->visitor->walkCompositeExpression($cb->andX($cb->eq("foo", 1), $cb->eq("bar", 1))); $this->assertInstanceOf('Doctrine\\ORM\\Query\\Expr\\Andx', $expr); $this->assertCount(2, $expr->getParts()); }
public function testWalkAndCompositeExpression() { $closure = $this->visitor->walkCompositeExpression($this->builder->andX($this->builder->eq("foo", 1), $this->builder->eq("bar", 1))); $this->assertTrue($closure(new TestObject(1, 1))); $this->assertFalse($closure(new TestObject(1, 0))); $this->assertFalse($closure(new TestObject(0, 1))); $this->assertFalse($closure(new TestObject(0, 0))); }
public function testWalkCompositeExpression() { $builder = new ExpressionBuilder(); $compositeExpr = $builder->andX($builder->eq('a', 1), $builder->neq('a', 2), $builder->eq('b', 3)); $expectedQuery = array('$and' => array(array('a' => 1), array('a' => array('$ne' => 2)), array('b' => 3))); $expr = $this->visitor->dispatch($compositeExpr); $this->assertInstanceOf('Doctrine\\ODM\\MongoDB\\Query\\Expr', $expr); $this->assertEquals($expectedQuery, $expr->getQuery()); }
function it_builds_andx(Comparison $comparison, CollectionsExpressionBuilder $expressionBuilder) { $this->andX([$comparison]); $expressionBuilder->andX([$comparison])->shouldHaveBeenCalled(); }
public function testInvalidAndXArgument() { $this->setExpectedException("RuntimeException"); $this->builder->andX("foo"); }
/** * {@inheritdoc} */ public function andX(...$expressions) { return $this->expressionBuilder->andX(...$expressions); }