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