Exemple #1
0
 /**
  * Method to test the loadFromObject method.
  * @since 1.0.0
  * @test
  */
 public function testLoadFromObject()
 {
     //create a Clan Entity.
     $clan = new Clan();
     //the object without prefix to load the Clan Entity.
     $object = new \stdClass();
     $object->id = 1;
     $object->name = 'Name';
     $object->tag = 'Tag';
     $object->website = 'Website';
     //load the object without prefix to the Clan Entity.
     $clan->loadFromObject($object);
     //check whether the values are valid.
     $this->assertEquals(1, $clan->id);
     $this->assertEquals('Name', $clan->name);
     $this->assertEquals('Tag', $clan->tag);
     $this->assertEquals('Website', $clan->website);
     //the object with prefix to load the Clan Entity.
     $object_prefix = new \stdClass();
     $object_prefix->test_id = 2;
     $object_prefix->test_name = 'TestName';
     $object_prefix->test_tag = 'TestTag';
     $object_prefix->test_website = 'TestWebsite';
     //load the object with prefix to the Clan Entity.
     $clan->loadFromObject($object_prefix, 'test_');
     //check whether the values are valid.
     $this->assertEquals(2, $clan->id);
     $this->assertEquals('TestName', $clan->name);
     $this->assertEquals('TestTag', $clan->tag);
     $this->assertEquals('TestWebsite', $clan->website);
 }