Skip to content

Commit

Permalink
[ckWebServicePlugin] added tests for passing doctrine and propel obje…
Browse files Browse the repository at this point in the history
…cts to the server;
  • Loading branch information
christiankerl committed Jan 10, 2010
1 parent b6062ed commit 6492ec4
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 37 deletions.
42 changes: 24 additions & 18 deletions test/functional/typeMappingDoctrineTest.php
Expand Up @@ -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',
Expand All @@ -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()));
45 changes: 26 additions & 19 deletions test/functional/typeMappingPropelTest.php
Expand Up @@ -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',
Expand All @@ -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()));

0 comments on commit 6492ec4

Please sign in to comment.