예제 #1
0
 /**
  * @covers SphinxSearch\Db\Sql\Sql::delete
  */
 public function testDelete()
 {
     $delete = $this->sql->delete();
     $this->assertInstanceOf('\\Zend\\Db\\Sql\\Delete', $delete);
     $this->assertSame('foo', $delete->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->delete('bar');
 }
예제 #2
0
 /**
  * @covers SphinxSearch\Indexer::delete
  * @covers SphinxSearch\Indexer::deleteWith
  */
 public function testDelete()
 {
     $mockDelete = $this->mockSql->delete('foo');
     $mockDelete->expects($this->once())->method('where')->with($this->equalTo('id = 2'));
     $affectedRows = $this->indexer->delete('foo', 'id = 2');
     $this->assertEquals(5, $affectedRows);
     // Where with closure
     $mockDelete = $this->mockSql->delete('foo');
     $this->indexer->delete('foo', function ($delete) use($mockDelete) {
         IndexerTest::assertSame($mockDelete, $delete);
     });
 }