Newer
Older
<?php
/**
* Copyright (c) 2012-2014, Agence Française Informatique (AFI). All rights reserved.
*
* it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by
* the Free Software Foundation.
*
* There are special exceptions to the terms and conditions of the AGPL as it
* is applied to this software (see README file).
*
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
class DatasControllerTest extends AbstractControllerTestCase {
protected $_storm_default_to_volatile = true;
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
$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é']);
}
protected function assertBody($content) {
$this->assertEquals($content, $this->_response->getBody());
/** @test */
public function fieldsOfSessionFormationShouldReturnJson() {
$this->dispatch('/opac/datas/fields/model/SessionFormation');
$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->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');