Beispiel #1
0
 /**
  * Method to test the update method.
  * @since 1.0.0
  * @test
  */
 public function testUpdate()
 {
     //the Account Entity which will be updated on database.
     $account = new Account();
     $account->id = 2;
     $account->name = 'BATTLELOG_USERNAME';
     $account->value = 'ExampleUser';
     //the AccountMapper to update the Account Entity on database.
     $accountMapper = new AccountMapper($this->getConnection()->getConnection());
     $accountMapper->update($account);
     //get the actual and expected table.
     $actualTable = $this->getConnection()->createQueryTable('account', 'SELECT * FROM account');
     $expectedDataset = __DIR__ . '/DataSets/Account/account-update.xml';
     $expectedTable = $this->createXMLDataSet($expectedDataset)->getTable('account');
     //check whether the tables are equal.
     $this->assertTablesEqual($expectedTable, $actualTable);
     //another Entity than Account Entity is not valid on the AccountMapper.
     $this->assertFalse($accountMapper->update(new Team()));
 }