/** * findAmbassadorByContact returns a generator with only elements of ambassadors * based on the country. */ public function testfindAmbassadorByCountry() { $country = new Country(); $country->setId(1); $ambassadorCollection = $this->ambassadorService->findAmbassadorByCountry($country); foreach ($ambassadorCollection as $ambassador) { $this->assertInstanceOf('Ambassador', $ambassador); // and all the ambassadors have the Country $this->assertEquals($ambassador->getCountry(), $country); } }
/** * Tests the Country. */ public function testCountry() { $ambassador = new Ambassador(); $this->assertInstanceOf("General\\Entity\\Country", $ambassador->getCountry()); // check if ambassador is initialized with an empty country $this->assertNull($ambassador->getCountry()->getId()); // if a new country is set check if it is set correctly $country = new Country(); $country->setId(rand(1, 10000)); $ambassador->setCountry($country); $this->assertEquals($country, $ambassador->getCountry()); }