public function testCustomConfigurationPassed() { $configuration = new GenericConfiguration(); $configuration->setLocale('nl-be')->setClientName('test')->setRequest(new Request()); $request = RequestFactory::createRequest($configuration); $this->assertSame($configuration, \PHPUnit_Framework_Assert::readAttribute($request, 'configuration')); }
/** * @expectedException LogicException */ public function testInvalidRequestFactoryCallbackReturnValue() { $conf = new GenericConfiguration(); $conf->setRequestFactory(function ($request) { return new \stdClass(); }); RequestFactory::createRequest($conf); }
public function testZalandoPHPRequestPerfomOperation() { $conf = new GenericConfiguration(); $operation = new Articles(); $request = $this->getMock('\\ZalandoPHP\\Request\\Rest\\Request', array('perform')); $request->expects($this->once())->method('perform')->with($this->equalTo($operation)); $conf->setRequest($request); $zalando = new ZalandoPHP($conf); $zalando->runOperation($operation); }
* Copyright 2015 Chris Schalenborgh <*****@*****.**> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'tests' . DIRECTORY_SEPARATOR . 'bootstrap.php'; use ZalandoPHP\ZalandoPHP; use ZalandoPHP\Configuration\GenericConfiguration; use ZalandoPHP\Operations\Facets; $conf = new GenericConfiguration(); try { $conf->setLocale('nl-NL')->setClientName('zalando-php-wrapper')->setResponseType('array'); } catch (\Exception $e) { echo $e->getMessage(); } $zalandoPHP = new ZalandoPHP($conf); //$facets = new Facets('category=fitness-kinderen'); $facets = new Facets('brandFamily=C70'); $formattedResponse = $zalandoPHP->runOperation($facets); echo '<pre>'; print_r($formattedResponse); echo '</pre>';
public function testConnectionTimeoutSetter() { $object = new GenericConfiguration(); $object->setConnectionTimeout(456); $this->assertEquals(456, $object->getConnectionTimeout()); }
* you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'tests' . DIRECTORY_SEPARATOR . 'bootstrap.php'; use ZalandoPHP\ZalandoPHP; use ZalandoPHP\Configuration\GenericConfiguration; use ZalandoPHP\Operations\Articles; $conf = new GenericConfiguration(); try { $conf->setLocale('nl-BE')->setClientName('zalando-php-wrapper')->setResponseType('array')->setTimeout(12)->setConnectionTimeout(45); } catch (\Exception $e) { echo $e->getMessage(); } $zalandoPHP = new ZalandoPHP($conf); $articles = new Articles(); //$articles->setColor('red,green'); //$articles->setBrand('BE1,ME1'); //$articles->setPage(3); //$articles->setPageSize(5); $articles->setCategory('baby-accessoires,baby-accessoires-promo,babys-schoenen,babys-schoenen-promo,babyslaapzak,babyslaapzak-promo,babyslofjes,babyslofjes-promo,kinderkleding-baby-ondergoed-rompers,kinderkleding-baby-ondergoed-rompers-promo,luxe-baby-accessoires'); $formattedResponse = $zalandoPHP->runOperation($articles); echo '<pre>'; print_r($formattedResponse);