Esempio n. 1
0
 /**
  * Method to test the delete method.
  * @since 1.0.0
  * @test
  */
 public function testDelete()
 {
     //the Clan Entity which will be deleted on database.
     $clan = new Clan();
     $clan->id = 2;
     //the ClanMapper to delete the Clan Entity on database.
     $clanMapper = new ClanMapper($this->getConnection()->getConnection());
     $clanMapper->delete($clan);
     //get the actual and expected table.
     $actualTable = $this->getConnection()->createQueryTable('clan', 'SELECT * FROM clan');
     $expectedDataset = __DIR__ . '/DataSets/Clan/clan-delete.xml';
     $expectedTable = $this->createXMLDataSet($expectedDataset)->getTable('clan');
     //check whether the tables are equal.
     $this->assertTablesEqual($expectedTable, $actualTable);
     //another Entity than Clan Entity is not valid on the ClanMapper.
     $this->assertFalse($clanMapper->delete(new Team()));
 }
Esempio n. 2
0
 /**
  * Method to test if the method delete() works.
  * @since 0.0.1-dev
  * @test
  */
 public function testDelete()
 {
     //The Clan which will be deleted on database.
     $clan = new Clan();
     $clan->id = 2;
     //The ClanMapper to delete the Clan on database.
     $clanMapper = new ClanMapper($this->pdo);
     $clanMapper->delete($clan);
     //Get the actual and expected table.
     $queryTable = $this->getConnection()->createQueryTable('clan', 'SELECT * FROM clan');
     $expectedDataSet = __DIR__ . '/DataSets/Clan/clan-delete.xml';
     $expectedTable = $this->createXMLDataSet($expectedDataSet)->getTable('clan');
     //Check if the tables are equal.
     $this->assertTablesEqual($expectedTable, $queryTable);
 }