Exemplo n.º 1
0
 /**
  * @covers ::execute
  * @covers ::setTypes
  * @covers \Triquanta\IziTravel\Request\FormTrait::setForm
  * @covers \Triquanta\IziTravel\Request\LimitTrait::setLimit
  * @covers \Triquanta\IziTravel\Request\LimitTrait::setOffset
  * @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)]];
     $limit = mt_rand();
     $offset = mt_rand();
     $formOptions = [MultipleFormInterface::FORM_COMPACT, MultipleFormInterface::FORM_FULL];
     $form = $formOptions[array_rand($formOptions)];
     $typesOptions = [MtgObjectInterface::TYPE_MUSEUM, MtgObjectInterface::TYPE_TOUR, 'city', 'museum'];
     $types = [$typesOptions[array_rand($typesOptions)]];
     $uuidOptions = ['bcf57367-77f6-4e39-9da6-1b481826501f', '3f879f37-21b0-479d-bd74-aa26f72fa328'];
     $uuid = $uuidOptions[array_rand($uuidOptions)];
     $includesOptions = ['city', 'country'];
     $includes = [$includesOptions[array_rand($includesOptions)]];
     $expectedParameters = ['languages' => $languageCodes, 'includes' => $includes, 'form' => $form, 'type' => $types, 'limit' => $limit, 'offset' => $offset];
     $this->requestHandler->expects($this->once())->method('get')->with($this->isType('string'), new \PHPUnit_Framework_Constraint_IsEqual($expectedParameters))->willReturn(json_encode([]));
     $this->sut->setLanguageCodes($languageCodes)->setUuid($uuid)->setForm($form)->setLimit($limit)->setOffset($offset)->setTypes($types)->setIncludes($includes)->execute();
 }