diff --git a/tests/application/modules/opac/controllers/DatasControllerTest.php b/tests/application/modules/opac/controllers/DatasControllerTest.php index c10d5b86701115056eb8167f8c3e1788dfd8048e..2a339913fa036a526e4ef90e2c75307e84017ca3 100644 --- a/tests/application/modules/opac/controllers/DatasControllerTest.php +++ b/tests/application/modules/opac/controllers/DatasControllerTest.php @@ -16,65 +16,72 @@ * * You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE * along with BOKEH; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ class DatasControllerTest extends AbstractControllerTestCase { + protected $_storm_default_to_volatile = true; + public function setUp() { parent::setUp(); - $this->fixture('Class_Formation', [ - 'id'=> 22, - 'sessions' => [ - $this->fixture('Class_SessionFormation', ['id'=>88, - 'date_debut' => '2014-12-12', - 'date_fin' => '2015-01-25']), - $this->fixture('Class_SessionFormation', ['id'=>89, - 'date_debut' => '2014-12-12', - 'date_fin' => '2015-01-25']), - $this->fixture('Class_SessionFormation', ['id'=>90, - 'date_debut' => '2014-12-12', - 'date_fin' => '2015-01-25']), - $this->fixture('Class_SessionFormation', ['id'=>91, - 'date_debut' => '2014-12-12', - 'date_fin' => '2015-01-25']) - ] - ]); - - $this->fixture('Class_CustomField', [ - 'id' => 19, - 'model' => 'SessionFormation', - 'meta' => $this->fixture('Class_CustomField_Meta', ['id' => 1, 'label' => 'thématique'])]); + $this->fixture('Class_Formation', + ['id'=> 22, + 'sessions' => [$this->fixture('Class_SessionFormation', + ['id'=>88, + 'date_debut' => '2014-12-12', + 'date_fin' => '2015-01-25']), + $this->fixture('Class_SessionFormation', + ['id'=>89, + 'date_debut' => '2014-12-12', + 'date_fin' => '2015-01-25']), + $this->fixture('Class_SessionFormation', + ['id'=>90, + 'date_debut' => '2014-12-12', + 'date_fin' => '2015-01-25']), + $this->fixture('Class_SessionFormation', + ['id'=>91, + 'date_debut' => '2014-12-12', + 'date_fin' => '2015-01-25']) + ] + ]); + + $this->fixture('Class_CustomField', + ['id' => 19, + 'model' => 'SessionFormation', + 'meta' => $this->fixture('Class_CustomField_Meta', + ['id' => 1, + 'label' => 'thématique'])]); + + $this->fixture('Class_CustomField_Value', + ['id' => 23, + 'custom_field_id' => 19, + 'value' => 'Macramé']); + } + - $this->fixture('Class_CustomField_Value', [ - 'id' => 23, - 'custom_field_id' => 19, - 'value' => 'Macramé' - ]); + protected function assertBody($content) { + $this->assertEquals($content, $this->_response->getBody()); } /** @test */ public function fieldsOfSessionFormationShouldReturnJson() { $this->dispatch('/opac/datas/fields/model/SessionFormation'); - $this->assertEquals( - '[{"priority":0,"id":19,"model":"SessionFormation","meta_id":1,"label":"th\u00e9matique","field_type":"text","options_list":""}]', - $this->_response->getBody()); + $this->assertBody('[{"priority":0,"id":19,"model":"SessionFormation","meta_id":1,"label":"th\u00e9matique","field_type":"text","options_list":"","indexable":0}]'); } /** @test */ public function valuesOfFieldThematiqueShouldReturnJson() { $this->dispatch('/opac/datas/values/field/19'); - $this->assertEquals( - '[{"value":"Macram\u00e9","id":23,"custom_field_id":19}]', - $this->_response->getBody()); + $this->assertBody('[{"value":"Macram\u00e9","id":23,"custom_field_id":19}]'); } + /** @test */ public function numberOfSessionForFormationShouldReturnJson() { $this->dispatch('/opac/datas/numberof/model/Class_Formation/id/22/children/Sessions'); - $this->assertEquals('4', $this->_response->getBody()); + $this->assertBody('4'); } -} -?> \ No newline at end of file +} \ No newline at end of file