Example #1
0
 /**
  * @covers SphinxSearch\Db\Sql\Sql::select
  */
 public function testSelect()
 {
     $select = $this->sql->select();
     $this->assertInstanceOf('\\SphinxSearch\\Db\\Sql\\Select', $select);
     $this->assertSame('foo', $select->getRawState('table'));
     $this->setExpectedException('\\SphinxSearch\\Db\\Sql\\Exception\\InvalidArgumentException', 'This Sql object is intended to work with only the table "foo" provided at construction time.');
     $this->sql->select('bar');
 }
Example #2
0
 /**
  * @covers SphinxSearch\Search::search
  * @covers SphinxSearch\Search::searchWith
  */
 public function testSearchWithWhereClosure()
 {
     $mockSelect = $this->mockSql->select();
     $mockSelect->expects($this->any())->method('getRawState')->will($this->returnValue(['table' => 'foo']));
     $this->search->search('foo', function ($select) use($mockSelect) {
         SearchTest::assertSame($mockSelect, $select);
     });
 }