| 16 | | $t = new lime_test(91, new lime_output_color()); |
|---|
| | 20 | $t = new lime_test(11, new lime_output_color()); |
|---|
| | 21 | |
|---|
| | 22 | $t->diag('test base functions'); |
|---|
| | 23 | |
|---|
| | 24 | //$blogCommentTable = Doctrine::getTable('BlogComment'); |
|---|
| | 25 | //$blogPostTable = Doctrine::getTable('BlogPost'); |
|---|
| | 26 | |
|---|
| | 27 | //$t->is(get_class($blogCommentTable->getWithRateAndUserQuery()), 'Doctrine_Query', 'getWithRateAndUserQuery() we can retrieve a query'); |
|---|
| | 28 | //$t->is(get_class($blogCommentTable->findAllWithRateAndUser()), 'Doctrine_Collection', 'findAllWithRateAndUser() we can retrieve rates and query same time'); |
|---|
| | 29 | //$t->is(get_class($blogPostTable->findAllWithRateAndUser()), 'Exception', 'findAllWithRateAndUser() throw an exception if object isnt associated to an User object'); |
|---|
| | 30 | // |
|---|
| | 31 | // |
|---|
| | 32 | //$blogPost = Doctrine::getTable('BlogPost')->findAllWithRates(); |
|---|
| | 33 | // |
|---|
| | 34 | //$t->is(get_class($blogPost), 'BlogPostRate', 'findAllWithRates include the right left joint'); |
|---|
| | 35 | // |
|---|
| | 36 | //$blogPostArray = Doctrine::getTable('BlogPost')->findAllWithRates(); |
|---|
| | 37 | // |
|---|
| | 38 | //$t->ok(in_array('Rate', array_keys($blogPostArray)), 'findAllWithRates work with arrays too'); |
|---|
| | 39 | //$t->is(get_class($blogComment->getRates()), 'Doctrine_Collection', 'getRates(), we can retrieve rates objects'); |
|---|
| | 40 | //$t->is($blogComment->getRates(Doctrine::HYDRATE_ARRAY), array(13 => array('id' => 1, 'rate' => 1, 'comment' => 'oui il y a des loutres qui sont comme �a', 'sf_guard_user_id' => 2)), 'getRates(), we can retrieve rates in array'); |
|---|
| | 41 | |
|---|
| | 42 | |
|---|
| | 43 | $t->diag('test configuration function'); |
|---|
| 21 | | $t->diag('test base functions'); |
|---|
| 22 | | |
|---|
| 23 | | $t->is(get_class($blogComment->getRates()), 'Doctrine_Collection', 'getRates(), we can retrieve rates objects'); |
|---|
| 24 | | $t->is($blogComment->getRates(Doctrine::HYDRATE_ARRAY), array(), 'getRates(), we can retrieve rates in array'); |
|---|
| 25 | | $t->is($blogComment->getRating(), array('rate' => '3'), 'getRating(), we can retrieve global rating'); |
|---|
| 26 | | |
|---|
| 27 | | $t->diag('test configuration function'); |
|---|
| 28 | | |
|---|
| 29 | | $t->is($blogComment->getRating(), array('rate' => '3'), 'getRating(), rating is rounded according to configuration'); |
|---|
| | 48 | $t->is($blogComment->getRating(), array('rate' => '3'), 'getRating(), we can retrieve global rating rounded according to configuration'); |
|---|
| 46 | | $blogComment->removeRatings(); |
|---|
| 47 | | $t->is($blogComment->getRateCount(), 0, 'we can remove all rating for an object'); |
|---|
| 48 | | $t->is($blogComment->getRating(), 0, 'if no rating, getRating return 0 default value'); |
|---|
| 49 | | $t->is($blogComment->getRates(), false, 'if no rating, getRates, return false'); |
|---|
| | 66 | $t->is($blogPost->getRateCount(), 12 , 'addRate() we can add a rate from a rate object'); |
|---|
| 51 | | $blogCommentRate = $blogComment->Rate->getFirst(); |
|---|
| | 68 | $blogPost->removeRatings(); |
|---|
| | 69 | $t->is($blogPost->getRateCount(), 0, 'getRateCount() we can remove all rating for an object'); |
|---|
| | 70 | $t->is($blogPost->getRating(), array('relevance' => 0, 'interest' => 0, 'spelling' => 0), 'getRating() if no rating, getRating return 0 default value'); |
|---|
| | 71 | //$t->is($blogComment->getRates(), false, 'if no rating, getRates, return false'); |
|---|
| | 72 | |
|---|
| | 73 | $blogCommentRate = $blogComment->getRates()->getFirst(); |
|---|