. */ /* */ /*************************************************************************************/ namespace SoColissimo\Tests\WebService; /** * Class BaseSoColissimoWebServiceTest * @package SoColissimo\Tests\WebService * @author Thelia */ class BaseSoColissimoWebServiceTest extends \PHPUnit_Framework_TestCase { public function testCall() { $instance = new \SoColissimo\WebService\FindByAddress(); $this->assertInstanceOf("\\SoapClient",$instance->getSoap()); } /** * @expectedException \BadFunctionCallException */ public function testBadFunctionCallException() { $instance = new \SoColissimo\WebService\FindByAddress(); $instance->FooBar(); } /** * @expectedException \Symfony\Component\Serializer\Exception\InvalidArgumentException */ public function testGetInvalidArgumentException() { $instance = new \SoColissimo\WebService\FindByAddress(); $instance->getFoo("bar"); } /** * @expectedException \Symfony\Component\Serializer\Exception\InvalidArgumentException */ public function testSetInvalidArgumentException() { $instance = new \SoColissimo\WebService\FindByAddress(); $instance->setFoo(); } /** * @expectedException \Symfony\Component\Serializer\Exception\InvalidArgumentException */ public function testSetInvalidArgumentException2() { $instance = new \SoColissimo\WebService\FindByAddress(); $instance->setFoo("apple", "banana"); } /** * @expectedException \BadFunctionCallException */ public function testGetBadFunctionCallException() { $instance = new \SoColissimo\WebService\FindByAddress(); $instance->getFoo(); } /** * @expectedException \Symfony\Component\Serializer\Exception\InvalidArgumentException */ public function testExceptFindByAddressExec() { $instance = new \SoColissimo\WebService\FindByAddress(); $instance ->setAddress("17 rue des gras") ->setZipCode("63000") ->setCity("Clermont-Ferrand") ->setCountryCode("FR") ->setFilterRelay("1") ->setRequestId("1234") ->setLang("FR") ->setOptionInter("1") ->setShippingDate(date("d/m/Y")) ->setWeight("20") ->setAccountNumber("123456") ->setPassword(utf8_encode(base64_decode("VGEgbehyZSBlbiBzbGlwIDwz"))) ; $instance->exec(); } public function testFindByAddressExec() { $instance = new \SoColissimo\WebService\FindByAddress(); $instance ->setAddress("17 rue des gras") ->setZipCode("63000") ->setCity("Clermont-Ferrand") ->setCountryCode("FR") ->setFilterRelay("1") ->setRequestId("1234") ->setLang("FR") ->setOptionInter("1") ->setShippingDate(date("d/m/Y")) ->setWeight("20") ->setAccountNumber("800734") ->setPassword("nass014") ; $response = $instance->exec(); $this->assertTrue(is_array($response)); } /** * @expectedException \Symfony\Component\Serializer\Exception\InvalidArgumentException */ public function testExceptFindByIdExec() { $instance = new \SoColissimo\WebService\FindById(); $instance ->setId("002572") ->setLangue("FR") ->setDate(date("d/m/Y")) ->setWeight("20") ->setAccountNumber("123456") ->setPassword(utf8_encode(base64_decode("VGhpcyBpcyBvcGVuc3R1ZGlv"))) ; $instance->exec(); } public function testFindByIdExec() { $instance = new \SoColissimo\WebService\FindById(); $instance ->setId("002572") ->setLangue("FR") ->setDate(date("d/m/Y")) ->setWeight("20") ->setAccountNumber("800734") ->setPassword("nass014") ; $response = $instance->exec(); $this->assertInstanceOf("\\stdclass",$response); } }