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

hotline #49363 migration patch

parent a36e4521
Branches
Tags
3 merge requests!1902Master,!1896Master,!1882Hotline#49363 custom fields facets
<?php
/**
* Copyright (c) 2012-2016, 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 Class_Migration_CleanCustomFieldsFacetsTest extends ModelTestCase {
protected $_storm_default_to_volatile = true,
$_response = false;
public function setUp() {
parent::setUp();
$this->_response = false;
$thesaurus = $this->fixture('Class_CodifThesaurus',
['id' => 3,
'id_origine' => 45,
'code' => 'Custom fields',
'libelle' => 'Custom public',
'id_thesaurus' => 'CFCF0001']);
$sql = $this->mock()
->whenCalled('execute')
->with('delete from codif_thesaurus where id_thesaurus like "CFCF0001%"')
->willDo(function()
{
Class_CodifThesaurus::find(3)->delete();
});
Zend_Registry::set('sql', $sql);
$this->onLoaderOfModel('Class_CodifThesaurus')
->whenCalled('findChildrenOf')
->answers([$thesaurus]);
}
/** @test */
public function customPublicShouldHaveBeenDeleted() {
(new Class_Migration_CleanCustomFieldsFacets())->run();
$this->assertNull(Class_CodifThesaurus::find(3));
}
/** @test */
public function customPublicShouldNotHaveBeenDeleted() {
$this->fixture('Class_CustomField_Meta',
['id' => 45,
'indexable' => 1]);
(new Class_Migration_CleanCustomFieldsFacets())->run();
$this->assertNotNull(Class_CodifThesaurus::find(3));
}
}
\ 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