Skip to content
Snippets Groups Projects
Commit 7c69ac03 authored by Ghislain Loas's avatar Ghislain Loas
Browse files

hotline #23465 update fixture to volatile in zone controller

parent b889dcf6
Branches
Tags
4 merge requests!896Master,!811Stable,!808Stable,!804Hotline #23465 fix bib url
......@@ -16,12 +16,12 @@
*
* 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
*/
require('includes.php');
try {
try {
if (isUserAgentBotAndNotAllowed())
exit;
......
......@@ -23,24 +23,19 @@ require_once 'AbstractControllerTestCase.php';
abstract class ZoneControllerTestCase extends AbstractControllerTestCase {
public function setUp() {
parent::setUp();
$this->zone_annecy = Class_Zone::getLoader()
->newInstanceWithId(2)
->setLibelle('Annecy')
->setCouleur('#123')
->setMapCoords('93,14,87,20')
->setImage('bassin annecy.jpg');
$this->zone_pringy = Class_Zone::getLoader()
->newInstanceWithId(4)
->setLibelle('Pringy')
->setCouleur('#456')
->setImage('pringy.jpg');
$this->zone_annecy = $this->fixture('Class_Zone',
['id' => 2,
'libelle' => 'Annecy',
'couleur' => '#123',
'map_coords' => '93,14,87,20',
'image' => 'bassin annecy.jpg']);
$this->loader_wrapper = Storm_Test_ObjectWrapper::onLoaderOfModel('Class_Zone')
->whenCalled('findAll')
->answers(array($this->zone_annecy, $this->zone_pringy))
->getWrapper();
$this->zone_pringy = $this->fixture('Class_Zone',
['id' => 4,
'libelle' => 'Pringy',
'couleur' => '#456',
'image' => 'pringy.jpg']);
}
}
......@@ -241,21 +236,10 @@ class ZoneControllerPostValidDataForAnnecyTest extends ZoneControllerTestCase {
public function setUp() {
parent::setUp();
$data = array('libelle' => 'Bassin annécien',
'couleur' => '123456',
'map_coords' => '34,45',
'image' => 'paquier.jpg');
$this->loader_wrapper
->whenCalled('save')
->answers(true);
$this
->getRequest()
->setMethod('POST')
->setPost($data);
$this->dispatch('admin/zone/edit/id/2');
$this->postDispatch('admin/zone/edit/id/2', ['libelle' => 'Bassin annécien',
'couleur' => '123456',
'map_coords' => '34,45',
'image' => 'paquier.jpg']);
}
......@@ -278,22 +262,12 @@ class ZoneControllerPostValidDataForAnnecyTest extends ZoneControllerTestCase {
}
class ZoneControllerPostEmptyLabelForAnnecyTest extends ZoneControllerTestCase {
public function setUp() {
parent::setUp();
$data = array('libelle' => '');
$this->loader_wrapper
->whenCalled('save')
->answers(true);
$this
->getRequest()
->setMethod('POST')
->setPost($data);
$this->dispatch('admin/zone/edit/id/2');
$this->postDispatch('admin/zone/edit/id/2', ['libelle' => '']);
}
......@@ -327,24 +301,12 @@ class ZoneControllerAddActionTest extends ZoneControllerTestCase {
/** @test */
function postShouldSaveNewObject() {
$data = array('libelle' => 'Cran',
'couleur' => '#456',
'map_coords' => '34,45',
'image' => 'paquier.jpg');
$this->loader_wrapper
->whenCalled('save')
->answers(true);
$this
->getRequest()
->setMethod('POST')
->setPost($data);
$this->dispatch('admin/zone/add');
$this->postDispatch('admin/zone/add', ['libelle' => 'Cran',
'couleur' => '#456',
'map_coords' => '34,45',
'image' => 'paquier.jpg']);
$new_zone = $this->loader_wrapper->getFirstAttributeForLastCallOn('save');
$this->assertEquals('Cran', $new_zone->getLibelle());
$this->assertEquals('Cran', Class_Zone::find(5)->getLibelle());
}
}
......
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