Skip to content
Snippets Groups Projects
Commit 5714417d authored by Patrick Barroca's avatar Patrick Barroca :grin:
Browse files

rel #21441 : fix tests

parent f59c9f80
Branches
Tags
3 merge requests!1132Hotline#29412 images des articles dans le resultat de recherche,!1120Master,!1075Dev#21441 creer des facettes a partir des custom fields
...@@ -16,65 +16,72 @@ ...@@ -16,65 +16,72 @@
* *
* You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE * You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
* along with BOKEH; if not, write to the Free Software * 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 { class DatasControllerTest extends AbstractControllerTestCase {
protected $_storm_default_to_volatile = true;
public function setUp() { public function setUp() {
parent::setUp(); parent::setUp();
$this->fixture('Class_Formation', [ $this->fixture('Class_Formation',
'id'=> 22, ['id'=> 22,
'sessions' => [ 'sessions' => [$this->fixture('Class_SessionFormation',
$this->fixture('Class_SessionFormation', ['id'=>88, ['id'=>88,
'date_debut' => '2014-12-12', 'date_debut' => '2014-12-12',
'date_fin' => '2015-01-25']), 'date_fin' => '2015-01-25']),
$this->fixture('Class_SessionFormation', ['id'=>89, $this->fixture('Class_SessionFormation',
'date_debut' => '2014-12-12', ['id'=>89,
'date_fin' => '2015-01-25']), 'date_debut' => '2014-12-12',
$this->fixture('Class_SessionFormation', ['id'=>90, 'date_fin' => '2015-01-25']),
'date_debut' => '2014-12-12', $this->fixture('Class_SessionFormation',
'date_fin' => '2015-01-25']), ['id'=>90,
$this->fixture('Class_SessionFormation', ['id'=>91, 'date_debut' => '2014-12-12',
'date_debut' => '2014-12-12', 'date_fin' => '2015-01-25']),
'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',
['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', [ protected function assertBody($content) {
'id' => 23, $this->assertEquals($content, $this->_response->getBody());
'custom_field_id' => 19,
'value' => 'Macramé'
]);
} }
/** @test */ /** @test */
public function fieldsOfSessionFormationShouldReturnJson() { public function fieldsOfSessionFormationShouldReturnJson() {
$this->dispatch('/opac/datas/fields/model/SessionFormation'); $this->dispatch('/opac/datas/fields/model/SessionFormation');
$this->assertEquals( $this->assertBody('[{"priority":0,"id":19,"model":"SessionFormation","meta_id":1,"label":"th\u00e9matique","field_type":"text","options_list":"","indexable":0}]');
'[{"priority":0,"id":19,"model":"SessionFormation","meta_id":1,"label":"th\u00e9matique","field_type":"text","options_list":""}]',
$this->_response->getBody());
} }
/** @test */ /** @test */
public function valuesOfFieldThematiqueShouldReturnJson() { public function valuesOfFieldThematiqueShouldReturnJson() {
$this->dispatch('/opac/datas/values/field/19'); $this->dispatch('/opac/datas/values/field/19');
$this->assertEquals( $this->assertBody('[{"value":"Macram\u00e9","id":23,"custom_field_id":19}]');
'[{"value":"Macram\u00e9","id":23,"custom_field_id":19}]',
$this->_response->getBody());
} }
/** @test */ /** @test */
public function numberOfSessionForFormationShouldReturnJson() { public function numberOfSessionForFormationShouldReturnJson() {
$this->dispatch('/opac/datas/numberof/model/Class_Formation/id/22/children/Sessions'); $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
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment