diff --git a/test/functional/typeMappingDoctrineTest.php b/test/functional/typeMappingDoctrineTest.php index 293afc5..556feb5 100644 --- a/test/functional/typeMappingDoctrineTest.php +++ b/test/functional/typeMappingDoctrineTest.php @@ -46,6 +46,28 @@ class myAuthor $Articles; } +function checkFixtureModel(ckTestSoapClient $c) +{ + $c->isFaultEmpty() + ->isCount('', 2) + ->isType('', 'ckGenericArray') + ->isType('0', 'myArticle') + ->isType('0.Authors', 'ckGenericArray') + ->isCount('0.Authors', 1) + ->isType('0.Authors.0', 'myAuthor') + ->isType('0.Comments', 'ckGenericArray') + ->isCount('0.Comments', 2) + ->isType('0.Comments.0', 'myComment') + ; + + $result = $c->getResult(); + + $t = $c->test(); + $t->cmp_ok($result[0]->Authors[0], '===', $result[1]->Authors[0]); + $t->cmp_ok($result[0]->Comments[0]->Article, '===', $result[0]->Comments[1]->Article); + $t->cmp_ok($result[0], '===', $result[0]->Comments[0]->Article); +} + $_options = array( 'classmap' => array( 'Article' => 'myArticle', @@ -58,22 +80,6 @@ class myAuthor ); $c = new ckTestSoapClient($_options); -$c->getFixtureModel() - ->isFaultEmpty() - ->isCount('', 2) - ->isType('', 'ckGenericArray') - ->isType('0', 'myArticle') - ->isType('0.Authors', 'ckGenericArray') - ->isCount('0.Authors', 1) - ->isType('0.Authors.0', 'myAuthor') - ->isType('0.Comments', 'ckGenericArray') - ->isCount('0.Comments', 2) - ->isType('0.Comments.0', 'myComment') - ; - -$result = $c->getResult(); -$t = $c->test(); -$t->cmp_ok($result[0]->Authors[0], '===', $result[1]->Authors[0]); -$t->cmp_ok($result[0]->Comments[0]->Article, '===', $result[0]->Comments[1]->Article); -$t->cmp_ok($result[0], '===', $result[0]->Comments[0]->Article); +checkFixtureModel($c->getFixtureModel()); +checkFixtureModel($c->passFixtureModel($c->getResult())); diff --git a/test/functional/typeMappingPropelTest.php b/test/functional/typeMappingPropelTest.php index 190c7c1..fb2c26b 100644 --- a/test/functional/typeMappingPropelTest.php +++ b/test/functional/typeMappingPropelTest.php @@ -53,6 +53,30 @@ class myAuthor $ArticleAuthors; } +function checkFixtureModel(ckTestSoapClient $c) +{ + $c->getFixtureModel() + ->isFaultEmpty() + ->isCount('', 2) + ->isType('', 'ckGenericArray') + ->isType('0', 'myArticle') + ->isType('0.ArticleAuthors', 'ckGenericArray') + ->isCount('0.ArticleAuthors', 1) + ->isType('0.ArticleAuthors.0', 'myArticleAuthor') + ->isType('0.ArticleAuthors.0.Author', 'myAuthor') + ->isType('0.ArticleComments', 'ckGenericArray') + ->isCount('0.ArticleComments', 2) + ->isType('0.ArticleComments.0', 'myArticleComment') + ; + + $result = $c->getResult(); + + $t = $c->test(); + $t->cmp_ok($result[0]->ArticleAuthors[0]->Author, '===', $result[1]->ArticleAuthors[0]->Author); + $t->cmp_ok($result[0]->ArticleComments[0]->Article, '===', $result[0]->ArticleComments[1]->Article); + $t->cmp_ok($result[0], '===', $result[0]->ArticleComments[0]->Article); +} + $_options = array( 'classmap' => array( 'Article' => 'myArticle', @@ -67,23 +91,6 @@ class myAuthor ); $c = new ckTestSoapClient($_options); -$c->getFixtureModel() - ->isFaultEmpty() - ->isCount('', 2) - ->isType('', 'ckGenericArray') - ->isType('0', 'myArticle') - ->isType('0.ArticleAuthors', 'ckGenericArray') - ->isCount('0.ArticleAuthors', 1) - ->isType('0.ArticleAuthors.0', 'myArticleAuthor') - ->isType('0.ArticleAuthors.0.Author', 'myAuthor') - ->isType('0.ArticleComments', 'ckGenericArray') - ->isCount('0.ArticleComments', 2) - ->isType('0.ArticleComments.0', 'myArticleComment') - ; - -$result = $c->getResult(); -$t = $c->test(); -$t->cmp_ok($result[0]->ArticleAuthors[0]->Author, '===', $result[1]->ArticleAuthors[0]->Author); -$t->cmp_ok($result[0]->ArticleComments[0]->Article, '===', $result[0]->ArticleComments[1]->Article); -$t->cmp_ok($result[0], '===', $result[0]->ArticleComments[0]->Article); +checkFixtureModel($c->getFixtureModel()); +checkFixtureModel($c->passFixtureModel($c->getResult())); \ No newline at end of file