/** * Test in method on two places to search and id is not found. */ public function testInTwoPlacesSearchNotFound() { $this->locationToLocationDataTransformer->expects($this->atLeastOnce())->method('transform')->will($this->returnArgument(0)); $searchInLocationId = 'id-test'; $searchInLocation = $this->getMockedLocation($searchInLocationId); $searchInParentOne = $this->getMockedLocation('id-parent-one'); $searchInParentTwo = $this->getMockedLocation('id-parent-two'); $parents = [$searchInParentOne, $searchInParentTwo]; $searchInLocation->expects($this->once())->method('getAllParents')->will($this->returnValue($parents)); $this->locationRepository->expects($this->once())->method('findOneBy')->with(['id' => $searchInLocationId])->will($this->returnValue($searchInLocation)); $response = $this->locationServiceProviderAdapter->in('id-test', ['id-search-in', 'id-search-also-here']); $this->assertFalse($response, 'The searched id should not be found'); }
/** * Given a location, return a simplified output using the * ValueObject LocationData, ready to be serialized * * @param LocationInterface $location The location to format. * * @return LocationData Formatted mode of Location */ private function formatOutputLocation(LocationInterface $location) { return $this->locationToLocationDataTransformer->transform($location); }