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

rel #21441 : fix tests

parent f59c9f80
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 @@
*
* 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
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