public function testInsertFromTable() { $tableNode = m::mock('\\Behat\\Gherkin\\Node\\TableNode'); $mockEntity = m::mock('\\Phabric\\Entity'); $mockEntity->shouldReceive('insertFromTable')->with($tableNode, m::any())->once(); $this->object->addEntity('TEST', $mockEntity); $this->object->insertFromTable('TEST', $tableNode); }
public function testUpdateFromTable() { $inTableData = array(array('name' => 'PHPNW', 'datetime' => '2011-10-08 09:00:00', 'venue' => 'Ramada Hotel', 'description' => 'A Great Conf!')); $update = array('name' => 'PHPNW', 'datetime' => '2011-10-08 10:00:00', 'venue' => 'Ramada Hotel MAN', 'description' => 'A Great Conf!'); $upTableData = array($update); $tableNode = m::mock('Behat\\Gherkin\\Node\\TableNode'); $tableNode->shouldReceive('getHash')->withNoArgs()->andReturn($inTableData, $upTableData)->twice(); $this->mockedConnection->shouldReceive('insert')->withAnyArgs()->once(); $this->mockedConnection->shouldReceive('update')->with("\\Phabric\\Entity", $update)->once(); $this->object->insertFromTable($tableNode); $this->object->updateFromTable($tableNode); }