/**
  * @test
  * @covers TEIShredder\NamedEntityGateway::findDistinctNotations
  */
 public function getAllDistinctNotations()
 {
     $pdoStatementMock = $this->getMockBuilder('PDOStatement')->setConstructorArgs(array())->getMock();
     $pdoStatementMock->expects($this->once())->method('execute')->with(array('person', 12345));
     $pdoStatementMock->expects($this->once())->method('fetchAll')->with(PDO::FETCH_ASSOC)->will($this->returnValue(array(array('notation' => 'Name2', 'notationhash' => 'fb554b3bb6'), array('notation' => 'Name1', 'notationhash' => 'b38422f17e'), array('notation' => 'Name1', 'notationhash' => 'b38422f17e'), array('notation' => 'Name2', 'notationhash' => 'fb554b3bb6'), array('notation' => 'Name1', 'notationhash' => 'b38422f17e'))));
     $pdoMock = $this->getMockBuilder('PDO')->setConstructorArgs(array('sqlite::memory:'))->getMock();
     $pdoMock->expects($this->once())->method('prepare')->will($this->returnValue($pdoStatementMock));
     $reflm = new \ReflectionProperty($this->obj, 'db');
     $reflm->setAccessible(true);
     $reflm->setValue($this->obj, $pdoMock);
     $actual = $this->obj->findDistinctNotations('person', 12345);
     $this->assertInternalType('array', $actual);
     $this->assertSame(2, count($actual));
     $this->assertSame(array('Name1', 3, 'b38422f17e'), $actual[0]);
     $this->assertSame(array('Name2', 2, 'fb554b3bb6'), $actual[1]);
 }
Example #2
0
 /**
  * {@inheritDoc}
  */
 protected function preProcessAction()
 {
     $this->elementGateway->flush($this->setup);
     $this->entityGateway->flush($this->setup);
 }