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