public function setUp() { $configuration = TestHelper::getConfiguration(); $this->eventDispatcher = $this->getMock('\\Symfony\\Component\\EventDispatcher\\EventDispatcherInterface'); $this->httpClient = new HttpClient(); $this->requestHandler = new ProductionRequestHandler($this->eventDispatcher, $this->httpClient, $configuration['apiKey']); $this->sut = new Client($this->requestHandler); }
public function setUp() { $configuration = TestHelper::getConfiguration(); $this->eventDispatcher = $this->getMock('\\Symfony\\Component\\EventDispatcher\\EventDispatcherInterface'); $this->productionHttpClient = new Client(); $this->productionRequestHandler = new StagingRequestHandler($this->eventDispatcher, $this->productionHttpClient, $configuration['apiKey']); $this->requestHandler = $this->getMock('\\Triquanta\\IziTravel\\Client\\RequestHandlerInterface'); }
/** * @covers ::execute * @covers \Triquanta\IziTravel\Request\FormTrait::setForm * @covers \Triquanta\IziTravel\Request\ModifiableTrait::setIncludes * @covers \Triquanta\IziTravel\Request\MultiLingualTrait::setLanguageCodes * @covers \Triquanta\IziTravel\Request\UuidTrait::setUuid */ public function testExecute() { $languageCodesOptions = ['en', 'nl', 'uk']; $languageCodes = [$languageCodesOptions[array_rand($languageCodesOptions)]]; $formOptions = [MultipleFormInterface::FORM_COMPACT, MultipleFormInterface::FORM_FULL]; $form = $formOptions[array_rand($formOptions)]; $includesOptions = ['city', 'country']; $includes = [$includesOptions[array_rand($includesOptions)]]; $uuidOptions = ['bcf57367-77f6-4e39-9da6-1b481826501f', '3f879f37-21b0-479d-bd74-aa26f72fa328']; $uuid = $uuidOptions[array_rand($uuidOptions)]; $expectedParameters = ['languages' => $languageCodes, 'includes' => $includes, 'form' => $form]; $this->requestHandler->expects($this->once())->method('get')->with($this->isType('string'), new \PHPUnit_Framework_Constraint_IsEqual($expectedParameters))->willReturn(TestHelper::getJsonResponse('publisher_full_include_all')); $this->sut->setLanguageCodes($languageCodes)->setUuid($uuid)->setForm($form)->setIncludes($includes)->execute(); }
/** * @covers ::createFromJson * @covers ::createFromData * @covers \Triquanta\IziTravel\DataType\MtgObjectBase::createBaseFromData * @covers ::getClassMap */ public function testCreateFromJson() { // Story navigation. $this->assertInstanceOf('\\Triquanta\\IziTravel\\DataType\\FullStoryNavigationInterface', MtgObjectBase::createFromJson(TestHelper::getJsonResponse('story_navigation_full_include_all'), MultipleFormInterface::FORM_FULL)); $this->assertInstanceOf('\\Triquanta\\IziTravel\\DataType\\CompactStoryNavigationInterface', MtgObjectBase::createFromJson(TestHelper::getJsonResponse('story_navigation_compact_include_all'), MultipleFormInterface::FORM_COMPACT)); // Tourist attraction. $this->assertInstanceOf('\\Triquanta\\IziTravel\\DataType\\FullTouristAttractionInterface', MtgObjectBase::createFromJson(TestHelper::getJsonResponse('tourist_attraction_full_include_all'), MultipleFormInterface::FORM_FULL)); $this->assertInstanceOf('\\Triquanta\\IziTravel\\DataType\\CompactTouristAttractionInterface', MtgObjectBase::createFromJson(TestHelper::getJsonResponse('tourist_attraction_compact_include_all'), MultipleFormInterface::FORM_COMPACT)); // Museum. $this->assertInstanceOf('\\Triquanta\\IziTravel\\DataType\\FullMuseumInterface', MtgObjectBase::createFromJson(TestHelper::getJsonResponse('museum_full_include_all'), MultipleFormInterface::FORM_FULL)); $this->assertInstanceOf('\\Triquanta\\IziTravel\\DataType\\CompactMuseumInterface', MtgObjectBase::createFromJson(TestHelper::getJsonResponse('museum_compact_include_all'), MultipleFormInterface::FORM_COMPACT)); // Tour. $this->assertInstanceOf('\\Triquanta\\IziTravel\\DataType\\FullTourInterface', MtgObjectBase::createFromJson(TestHelper::getJsonResponse('tour_full_include_all'), MultipleFormInterface::FORM_FULL)); $this->assertInstanceOf('\\Triquanta\\IziTravel\\DataType\\CompactTourInterface', MtgObjectBase::createFromJson(TestHelper::getJsonResponse('tour_compact_include_all'), MultipleFormInterface::FORM_COMPACT)); // Exhibit. $this->assertInstanceOf('\\Triquanta\\IziTravel\\DataType\\FullExhibitInterface', MtgObjectBase::createFromJson(TestHelper::getJsonResponse('exhibit_full_include_all'), MultipleFormInterface::FORM_FULL)); $this->assertInstanceOf('\\Triquanta\\IziTravel\\DataType\\CompactExhibitInterface', MtgObjectBase::createFromJson(TestHelper::getJsonResponse('exhibit_compact_include_all'), MultipleFormInterface::FORM_COMPACT)); // Collection. $this->assertInstanceOf('\\Triquanta\\IziTravel\\DataType\\FullCollectionInterface', MtgObjectBase::createFromJson(TestHelper::getJsonResponse('collection_full_include_all'), MultipleFormInterface::FORM_FULL)); $this->assertInstanceOf('\\Triquanta\\IziTravel\\DataType\\CompactCollectionInterface', MtgObjectBase::createFromJson(TestHelper::getJsonResponse('collection_compact_include_all'), MultipleFormInterface::FORM_COMPACT)); }
/** * @covers ::createFromJson * @covers ::createFromData * @covers \Triquanta\IziTravel\DataType\CountryBase::createBaseFromData */ public function testCreateFromJson() { CompactCountry::createFromJson(TestHelper::getJsonResponse('country_compact_include_all'), MultipleFormInterface::FORM_COMPACT); }
/** * @covers ::createFromJson * @covers ::createFromData */ public function testCreateFromData() { $this->assertInstanceOf('\\Triquanta\\IziTravel\\DataType\\FullCountryInterface', CountryBase::createFromJson(TestHelper::getJsonResponse('country_full_include_all'), MultipleFormInterface::FORM_FULL)); $this->assertInstanceOf('\\Triquanta\\IziTravel\\DataType\\CompactCountryInterface', CountryBase::createFromJson(TestHelper::getJsonResponse('country_compact_include_all'), MultipleFormInterface::FORM_COMPACT)); }
/** * @covers ::createFromJson * @covers ::createFromData */ public function testCreateFromJson() { FullTouristAttraction::createFromJson(TestHelper::getJsonResponse('tourist_attraction_full_include_all'), MultipleFormInterface::FORM_FULL); }
/** * @covers ::createFromJson * @covers ::createFromData * @covers \Triquanta\IziTravel\DataType\CountryBase::createBaseFromData */ public function testCreateFromJson() { FullCountry::createFromJson(TestHelper::getJsonResponse('country_full_include_all'), MultipleFormInterface::FORM_FULL); }
/** * @covers ::createFromJson * @covers ::createFromData */ public function testCreateFromJson() { CompactTouristAttraction::createFromJson(TestHelper::getJsonResponse('tourist_attraction_compact_include_all'), MultipleFormInterface::FORM_COMPACT); }
/** * @covers ::createFromJson * @covers ::createFromData */ public function testCreateFromJson() { CompactMuseum::createFromJson(TestHelper::getJsonResponse('museum_compact_include_all'), MultipleFormInterface::FORM_FULL); }
/** * @covers ::createFromJson * @covers ::createFromData * @covers \Triquanta\IziTravel\DataType\MtgObjectBase::createBaseFromData */ public function testCreateFromJson() { /** @var \Triquanta\IziTravel\DataType\CompactMtgObjectBase $class */ $class = get_class($this->sut); $class::createFromJson(TestHelper::getJsonResponse('story_navigation_compact_include_all'), MultipleFormInterface::FORM_COMPACT); }
/** * @covers ::createFromJson * @covers ::createFromData * @covers \Triquanta\IziTravel\DataType\MtgObjectBase::createBaseFromData */ public function testCreateFromJson() { /** @var \Triquanta\IziTravel\DataType\FullMtgObjectBase $class */ $class = get_class($this->sut); $this->sut = $class::createFromJson(TestHelper::getJsonResponse('tour_full_include_all'), MultipleFormInterface::FORM_FULL); }