Esempio n. 1
0
 /**
  * Method to test the update method.
  * @since 1.0.0
  * @test
  */
 public function testUpdate()
 {
     //the Clan Entity which will be updated on database.
     $clan = new Clan();
     $clan->id = 2;
     $clan->name = 'Clanify Gaming';
     $clan->tag = 'CG';
     $clan->website = 'http://clanify.rocks/gaming';
     //the ClanMapper to update the Clan Entity on database.
     $clanMapper = new ClanMapper($this->getConnection()->getConnection());
     $clanMapper->update($clan);
     //get the actual and expected table.
     $actualTable = $this->getConnection()->createQueryTable('clan', 'SELECT * FROM clan');
     $expectedDataset = __DIR__ . '/DataSets/Clan/clan-update.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->update(new Team()));
 }