public function before() { $this->queryBuilder = Mockery::mock('QueryBuilder'); $this->clauseParser = new ClauseParser(); $this->query = new MultipleRecordsQuery($this->queryBuilder, $this->clauseParser, array('prefix' => 'm', 'idField' => 'id')); $this->clauseParser->add('id', 'm.id')->equalTo(); $this->clauseParser->add('name', 'm.name')->startsWith(); $this->clauseParser->add('users', 'm.user_id')->in(); }
/** * Parse the clauses, and add them to the query builder * * @param array $clauses * @return AbstractQuery * @throws QueryException If the results have already been materialized */ public function where(array $clauses) { $this->assertCanBeModified(); $this->queryBuilder->andWhere($this->clauseParser->parse($clauses)); return $this; }
/** * @expectedException MistyDoctrine\Exception\QueryException */ public function testMissingClause() { $parser = new ClauseParser(); $parser->parse(array('missing-clause' => 1)); }