function checkFixtureModel(ckTestSoapClient $c, $withAuthor) { $c->isFaultEmpty()->isCount('', 2)->isType('', 'ckGenericArray')->isType('0', 'myArticle')->is('0.id', 1)->is('0.title', 'Howto Build Webservices in Symfony')->is('0.content', 'Some Content.')->isType('0.ArticleAuthors', 'ckGenericArray')->isType('0.ArticleComments', 'ckGenericArray')->isCount('0.ArticleComments', 2)->isType('0.ArticleComments.0', 'myArticleComment')->is('0.ArticleComments.0.content', 'Physics is great!')->is('0.ArticleComments.0.author', 'Isaac Newton')->isType('0.ArticleComments.1', 'myArticleComment')->is('0.ArticleComments.1.content', 'I like cars!')->is('0.ArticleComments.1.author', 'Henry Ford')->isType('1', 'myArticle')->is('1.id', 2)->is('1.title', 'Howto Write Tests In Symfony')->is('1.content', 'Some Content.')->isType('1.ArticleAuthors', 'ckGenericArray')->isType('1.ArticleComments', 'ckGenericArray')->isCount('1.ArticleComments', 1)->isType('1.ArticleComments.0', 'myArticleComment')->is('1.ArticleComments.0.content', 'Alles ist relativ!')->is('1.ArticleComments.0.author', 'Albert Einstein'); $result = $c->getResult(); $t = $c->test(); $t->cmp_ok($result[0]->ArticleComments[0]->Article, '===', $result[0]->ArticleComments[1]->Article); $t->cmp_ok($result[0], '===', $result[0]->ArticleComments[0]->Article); if ($withAuthor) { $c->isCount('0.ArticleAuthors', 1)->isType('0.ArticleAuthors.0', 'myArticleAuthor')->isType('0.ArticleAuthors.0.Author', 'myAuthor')->is('0.ArticleAuthors.0.Author.id', 1)->is('0.ArticleAuthors.0.Author.name', 'Christian Kerl')->isCount('0.ArticleAuthors.0.Author.ArticleAuthors', 2)->isCount('1.ArticleAuthors', 1)->isType('1.ArticleAuthors.0', 'myArticleAuthor')->isType('1.ArticleAuthors.0.Author', 'myAuthor')->is('1.ArticleAuthors.0.Author.id', 1)->is('1.ArticleAuthors.0.Author.name', 'Christian Kerl')->isCount('1.ArticleAuthors.0.Author.ArticleAuthors', 2); $t->ok($result[0]->ArticleAuthors[0]->Author === $result[1]->ArticleAuthors[0]->Author); $t->ok($result[0] === $result[0]->ArticleAuthors[0]->Article); $t->ok($result[1] === $result[1]->ArticleAuthors[0]->Article); } }
<?php /** * This file is part of the ckWebServicePlugin * * @package ckWebServicePlugin * @author Christian Kerl <*****@*****.**> * @copyright Copyright (c) 2008, Christian Kerl * @license http://www.opensource.org/licenses/mit-license.php MIT License * @version SVN: $Id: soapFaultTest.php 26444 2010-01-10 00:30:13Z chrisk $ */ $app = 'frontend'; $env = 'soapTestServiceApi'; $debug = true; include_once dirname(__FILE__) . '/../bootstrap/functional.php'; $c = new ckTestSoapClient(); // test executeException $c->test_exception()->hasFault('TestException'); // test executeSoapFault $c->test_soapFault()->hasFault('TestSoapFault');
include_once dirname(__FILE__) . '/../bootstrap/functional.php'; class MyComplexNumber { public $realPart; public $imaginaryPart; public function __construct($realPart, $imaginaryPart) { $this->realPart = $realPart; $this->imaginaryPart = $imaginaryPart; } } class MyAuthData { public $username; public $password; } $_options = array('classmap' => array('ComplexNumber' => 'MyComplexNumber', 'AuthHeader' => 'MyAuthData')); $c = new ckTestSoapClient($_options); // test executeMultiply $c->math_multiply(2, 5)->isFaultEmpty()->isType('', 'double')->is('', 10); // test executeSimpleMulitply $c->SimpleMultiply(2, 5)->isFaultEmpty()->isType('', 'double')->is('', 10); // test executeArrayMultiply $c->ArrayMultiply(array(1, 2, 3, 4))->isFaultEmpty()->isType('', 'double')->is('', 24); // test executeComplexMultiply $c->ComplexMultiply(array(new MyComplexNumber(1, 0), new MyComplexNumber(1, 0)))->isFaultEmpty()->isType('', 'MyComplexNumber')->is('realPart', 1)->is('imaginaryPart', 0); // test executeSimpleMultiplyWithHeader $authData = new MyAuthData(); $authData->username = '******'; $authData->password = '******'; $c->addRequestHeader('AuthHeaderElement', $authData)->SimpleMultiplyWithHeader(5, 2)->isFaultEmpty()->isHeaderType('AuthHeaderElement', 'MyAuthData')->isHeader('AuthHeaderElement.username', 'test')->isHeader('AuthHeaderElement.password', 'secret')->isType('', 'double')->is('', 10);
/** * Gets the lime_test shared amongst all instances of ckTestSoapClient. * * @return lime_test A lime_test instance */ public function test() { if (is_null(self::$test)) { self::$test = new lime_test(null, new lime_output_color()); } return self::$test; }
<?php /** * This file is part of the ckWebServicePlugin * * @package ckWebServicePlugin * @author Christian Kerl <*****@*****.**> * @copyright Copyright (c) 2008, Christian Kerl * @license http://www.opensource.org/licenses/mit-license.php MIT License * @version SVN: $Id: soapFaultNoDebugTest.php 20950 2009-08-08 20:45:00Z chrisk $ */ $app = 'frontend'; $env = 'soapTestServiceApi'; $debug = false; include_once dirname(__FILE__) . '/../bootstrap/functional.php'; $c = new ckTestSoapClient(); // test executeException $c->test_exception()->hasFault('Internal Server Error'); // test executeSoapFault $c->test_soapFault()->hasFault('TestSoapFault');
<?php /** * This file is part of the ckWebServicePlugin * * @package ckWebServicePlugin * @author Christian Kerl <*****@*****.**> * @copyright Copyright (c) 2008, Christian Kerl * @license http://www.opensource.org/licenses/mit-license.php MIT License * @version SVN: $Id: soapHeaderTest.php 26444 2010-01-10 00:30:13Z chrisk $ */ $app = 'frontend'; $env = 'soapTestServiceApi'; $debug = true; include_once dirname(__FILE__) . '/../bootstrap/functional.php'; $_options = array('classmap' => array('ExtraHeader' => 'ExtraHeaderData', 'AuthHeader' => 'AuthData')); $c = new ckTestSoapClient($_options); // test executeHeaderSingle $authData = new AuthData(); $authData->username = '******'; $authData->password = '******'; $c->addRequestHeader('AuthHeaderElement', $authData)->test_headerSingle()->isFaultEmpty()->isHeaderType('AuthHeaderElement', 'AuthData')->isHeader('AuthHeaderElement.username', 'reset')->isHeader('AuthHeaderElement.password', 'reset'); // test executeHeaderMulti $authData = new AuthData(); $authData->username = '******'; $authData->password = '******'; $testData = new ExtraHeaderData(); $testData->content = 'input'; $c->addRequestHeader('AuthHeaderElement', $authData)->addRequestHeader('ExtraHeaderElement', $testData)->test_headerMulti()->isFaultEmpty()->isHeaderType('AuthHeaderElement', 'AuthData')->isHeader('AuthHeaderElement.username', 'reset')->isHeader('AuthHeaderElement.password', 'reset')->isHeaderType('ExtraHeaderElement', 'ExtraHeaderData')->isHeader('ExtraHeaderElement.content', 'HandledInput(input)');
<?php /** * This file is part of the ckWebServicePlugin * * @package ckWebServicePlugin * @author Christian Kerl <*****@*****.**> * @copyright Copyright (c) 2008, Christian Kerl * @license http://www.opensource.org/licenses/mit-license.php MIT License * @version SVN: $Id: resultAdapterTest.php 29892 2010-06-18 14:53:30Z chrisk $ */ $app = 'frontend'; $env = 'soapTestServiceApi'; $debug = true; include_once dirname(__FILE__) . '/../bootstrap/functional.php'; $c = new ckTestSoapClient(); // test executeConfiguredProperty (Ticket #8769) $c->test_configuredProperty()->isFaultEmpty()->isType('', 'string')->is('', 'MyCustomResult'); // test executeGetResult (Ticket #8474) $c->nonLC_name_getResult()->isFaultEmpty()->isType('', 'string')->is('', 'MyCustomResult'); // test executeMethodResult $c->test_methodResult()->isFaultEmpty()->isType('', 'string')->is('', 'TestResponse'); // test executeRenderResult $c->test_renderResult()->isFaultEmpty()->isType('', 'string')->is('', 'List: a, b, 1, 2');
/** * This file is part of the ckWebServicePlugin * * @package ckWebServicePlugin * @author Christian Kerl <*****@*****.**> * @copyright Copyright (c) 2008, Christian Kerl * @license http://www.opensource.org/licenses/mit-license.php MIT License * @version SVN: $Id: typeMappingTest.php 20950 2009-08-08 20:45:00Z chrisk $ */ $app = 'frontend'; $env = 'soapTestServiceApi'; $debug = true; include_once dirname(__FILE__) . '/../bootstrap/functional.php'; $_options = array('classmap' => array('TestData' => 'TestData', 'StringArray' => 'ckGenericArray', 'TestDataArray' => 'ckGenericArray', 'StringArrayArray' => 'ckGenericArray')); $c = new ckTestSoapClient($_options); // test executeNoArg $c->test_noArg()->isFaultEmpty()->isType('', 'boolean')->is('', true); // test executeSimple $c->test_simple(true, 5, 'a string', 1.5)->isFaultEmpty()->isType('', 'boolean')->is('', true); // test executeComplex $object = new TestData(); $object->content = 'a string'; $c->test_complex($object)->isFaultEmpty()->isType('', 'TestData')->is('content', $object->content); // test arraySimple $array = array(1, 2, 3, 4); $c->test_arraySimple($array)->isFaultEmpty()->isType('', 'ckGenericArray')->isCount('', 2)->is('0', 'a')->is('1', 'b'); // test arrayComplex $object = new TestData(); $object->content = 'a string'; $array = array($object);