Newer
Older
<?php
/**
* Copyright (c) 2012-2017, Agence Française Informatique (AFI). All rights reserved.
*
* BOKEH is free software; you can redistribute it and/or modify
* 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).
*
* BOKEH is distributed in the hope that it will be useful,
* 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
* along with BOKEH; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
class Pcdm4BrowserIndexChildrenTest extends Admin_AbstractControllerTestCase{
protected $_storm_default_to_volatile = true;
public function setUp() {
parent::setUp();
Class_AdminVar::set('CODIFICATION_BROWSER', 1);
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
$mainstream = $this->fixture('Class_CodifPcdm4',
['id' => '0',
'libelle' => 'Mainstream']);
$notso = $this->fixture('Class_CodifPcdm4',
['id' => '01',
'libelle' => 'Not so mainstream']);
$notsoleaf = $this->fixture('Class_CodifPcdm4',
['id' => '02',
'libelle' => 'Not so leaf']);
$this->onLoaderOfModel('Class_CodifPcdm4')
->whenCalled('find')->with('0')->answers($mainstream)
->whenCalled('findParentOf')->with($mainstream)->answers(null)
->whenCalled('findNodesOfBy')->with($mainstream, [])->answers([$notso])
->whenCalled('recursiveNumberOfChildrenOf')->with($notso)->answers(1)
->whenCalled('findLeavesOfBy')
->with($mainstream, ['limitPage' => [null, 25],
'order' => 'id_pcdm4'])
->answers([$notsoleaf])
->whenCalled('findLeavesOfBy')
->with($mainstream, [])
->answers([$notsoleaf])
->beStrict();
$this->dispatch('/admin/pcdm4-browser/index/parent_id/0', true);
}
/** @test */
public function mainstreamShouldBeDisplay() {
$this->assertXpathContentContains('//a', 'Mainstream', $this->_response->getBody());
}
/** @test */
public function notsoShouldBeInTable() {
$this->assertXpathContentContains('//td', 'Not so mainstream');
}
/** @test */
public function notsoleafShouldBeInTable() {
$this->assertXpathContentContains('//td', 'Not so leaf');
}
}