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();
 }
Пример #2
0
 public function testShortCut()
 {
     $parser = new ClauseParser();
     $parser->add('category', 'c.category_id')->equalTo()->defaultTo(2);
     $sql = $parser->parse(array('category' => 1));
     $this->assertEquals("c.category_id = 1", $sql);
 }