public function testShouldUnmapPageImposition() { //GIVEN $oPage = AM_Model_Db_Table_Abstract::factory('page_imposition')->findOneBy('id', 1); $oMapper = AM_Mapper_Abstract::factory($oPage, "sqlite", array('adapter' => $this->_oAdapter)); /* @var $oMapper AM_Mapper_Sqlite_Page */ //WHEN $oMapper->unmap(); //THEN $oGivenDataSet = $this->_oConnectionMock->createQueryTable('page_imposition', 'SELECT page_id, is_linked_to, position_type FROM page_imposition ORDER BY id'); $oExpectedDataSet = $this->createFlatXMLDataSet(dirname(__FILE__) . '/_dataset/PageImpositionMapperSqliteTest.xml')->getTable('page_imposition'); $this->assertTablesEqual($oExpectedDataSet, $oGivenDataSet); }
public function testShouldUnmapPage() { //GIVEN $oPage = AM_Model_Db_Table_Abstract::factory('page')->findOneBy('id', 1); $oMapper = AM_Mapper_Abstract::factory($oPage, "sqlite", array('adapter' => $this->_oAdapter)); /* @var $oMapper AM_Mapper_Sqlite_Page */ //WHEN $oMapper->unmap(); //THEN $oGivenDataSet = $this->_oSqliteConnectionMock->createQueryTable("page", "SELECT id, title, horisontal_page_id, template, machine_name, color FROM page ORDER BY id"); $oExpectedDataSet = $this->createFlatXMLDataSet(dirname(__FILE__) . '/_dataset/PageMapperSqliteTest.xml')->getTable('page'); $this->assertTablesEqual($oExpectedDataSet, $oGivenDataSet); }
public function testShouldUnmapTerm() { //GIVEN $oPage = AM_Model_Db_Table_Abstract::factory('term')->findOneBy('id', 1); $oMapper = AM_Mapper_Abstract::factory($oPage, "sqlite", array('adapter' => $this->_oAdapter)); /* @var $oMapper AM_Mapper_Sqlite_Page */ //WHEN $oMapper->unmap(); //THEN $oGivenDataSet = $this->_oSqliteConnectionMock->createQueryTable("menu", "SELECT title, description, thumb_stripe, thumb_summary, color, firstpage_id FROM menu ORDER BY id"); $oExpectedDataSet = $this->createFlatXMLDataSet(dirname(__FILE__) . '/_dataset/TermMapperSqliteTest.xml')->getTable('menu'); $this->assertTablesEqual($oExpectedDataSet, $oGivenDataSet); }
public function testShouldUnmapElement() { //GIVEN $oElement = AM_Model_Db_Table_Abstract::factory('element')->findOneBy('id', 1); $oMapper = AM_Mapper_Abstract::factory($oElement, 'sqlite', array('adapter' => $this->_oAdapter)); /* @var $oMapper AM_Mapper_Sqlite_Page */ //WHEN $oMapper->unmap(); //THEN //Element $oGivenDataSet = $this->_oConnectionMock->createQueryTable('element', 'SELECT id, page_id, element_type_name, weight, content_text FROM element ORDER BY id'); $oExpectedDataSet = $this->createFlatXMLDataSet(dirname(__FILE__) . '/_dataset/CrosswordGameMapperSqliteTest.xml')->getTable('element'); $this->assertTablesEqual($oExpectedDataSet, $oGivenDataSet); //Element data $oGivenDataSet = $this->_oConnectionMock->createQueryTable('element_data', 'SELECT element_id, type, value FROM element_data ORDER BY id'); $oExpectedDataSet = $this->createFlatXMLDataSet(dirname(__FILE__) . '/_dataset/CrosswordGameMapperSqliteTest.xml')->getTable('element_data'); $this->assertTablesEqual($oExpectedDataSet, $oGivenDataSet); //Game $oGivenDataSet = $this->_oConnectionMock->createQueryTable('game_crossword', 'SELECT id, grid_width, grid_height FROM game_crossword ORDER BY id'); $oExpectedDataSet = $this->createFlatXMLDataSet(dirname(__FILE__) . '/_dataset/CrosswordGameMapperSqliteTest.xml')->getTable('game_crossword'); $this->assertTablesEqual($oExpectedDataSet, $oGivenDataSet); //Crossword word $oGivenDataSet = $this->_oConnectionMock->createQueryTable('game_crossword_word', 'SELECT game, answer, question, length, direction, start_x, start_y FROM game_crossword_word ORDER BY id'); $oExpectedDataSet = $this->createFlatXMLDataSet(dirname(__FILE__) . '/_dataset/CrosswordGameMapperSqliteTest.xml')->getTable('game_crossword_word'); $this->assertTablesEqual($oExpectedDataSet, $oGivenDataSet); }
public function testShouldUnmapElement() { //GIVEN $oElement = AM_Model_Db_Table_Abstract::factory('element')->findOneBy('id', 1); $oMapper = AM_Mapper_Abstract::factory($oElement, "sqlite", array('adapter' => $this->_oAdapter)); /* @var $oMapper AM_Mapper_Sqlite_Page */ //WHEN $oMapper->unmap(); //THEN //Element $oGivenDataSet = $this->_oConnectionMock->createQueryTable('element', 'SELECT id, page_id, element_type_name, weight, content_text FROM element ORDER BY id'); $oExpectedDataSet = $this->createFlatXMLDataSet(dirname(__FILE__) . '/_dataset/ElementWithPdfInfoMapperSqliteTest.xml')->getTable('element'); $this->assertTablesEqual($oExpectedDataSet, $oGivenDataSet); //Element data $oGivenDataSet = $this->_oConnectionMock->createQueryTable('element_data', 'SELECT element_id, type, value, position_id FROM element_data ORDER BY id'); $oExpectedDataSet = $this->createFlatXMLDataSet(dirname(__FILE__) . '/_dataset/ElementWithPdfInfoMapperSqliteTest.xml')->getTable('element_data'); $this->assertTablesEqual($oExpectedDataSet, $oGivenDataSet); //Element data position $oGivenDataSet = $this->_oConnectionMock->createQueryTable('element_data_position', 'SELECT id, start_x, end_x, start_y, end_y FROM element_data_position ORDER BY id'); $oExpectedDataSet = $this->createFlatXMLDataSet(dirname(__FILE__) . '/_dataset/ElementWithPdfInfoMapperSqliteTest.xml')->getTable('element_data_position'); $this->assertTablesEqual($oExpectedDataSet, $oGivenDataSet); }
public function testGetSchema() { $fixtureSchema = "schema"; $connection = new Zend_Test_PHPUnit_Db_Connection($this->adapterMock, $fixtureSchema); $this->assertEquals($fixtureSchema, $connection->getSchema()); }