From 0484bca06a5bd7ac7992b66f942e07a9d75ae826 Mon Sep 17 00:00:00 2001 From: Laurent Laffont <llaffont@afi-sa.fr> Date: Mon, 22 Oct 2018 16:51:52 +0200 Subject: [PATCH] improve testing performances Conflicts: tests/library/Class/WebService/WebAnalyticsClientTest.php --- .../tests/php/classes/ModelTestCase.php | 18 +- library/Class/Batch/BuildSiteMap.php | 1 + library/Class/Crypt.php | 6 +- library/Class/PanierNotice.php | 2 +- library/Class/Testing/PhpCommand.php | 1 + .../modules/AbstractControllerTestCase.php | 58 +--- .../ImportFichierCsvElectreTest.php | 46 +-- .../ImportFichierGenerationSiteTest.php | 6 +- .../admin/controllers/UsersControllerTest.php | 1 + .../controllers/DomainsControllerTest.php | 5 + tests/bootstrap.php | 1 + tests/library/Class/ActivityTest.php | 11 +- tests/library/Class/AdminVarTest.php | 4 +- tests/library/Class/AgendaSQYImportTest.php | 2 +- .../Class/Album/UsageConstraintTest.php | 2 +- .../LeafletTilesGeneratorTest.php | 16 +- tests/library/Class/AlbumTest.php | 4 +- tests/library/Class/ArteVodLinkTest.php | 4 +- tests/library/Class/ArticleCategorieTest.php | 4 +- tests/library/Class/ArticleTest.php | 30 +- .../library/Class/Autocomplete/IndexTest.php | 10 +- tests/library/Class/AvisNoticeTest.php | 6 +- tests/library/Class/AvisTest.php | 12 +- tests/library/Class/BatchTest.php | 22 +- tests/library/Class/BibTest.php | 4 +- tests/library/Class/CatalogueTest.php | 4 +- tests/library/Class/CodificationTest.php | 2 +- tests/library/Class/DecodageUnimarcTest.php | 8 +- tests/library/Class/DuplicateInProfilTest.php | 2 +- tests/library/Class/DynamicUserGroupTest.php | 2 +- tests/library/Class/EADTest.php | 4 +- tests/library/Class/ExemplaireTest.php | 8 +- tests/library/Class/FRBR/LinkTest.php | 2 +- tests/library/Class/FormulaireTest.php | 8 +- .../Class/GlobalSqlRefactoringTest.php | 2 +- tests/library/Class/IntBibTest.php | 4 +- tests/library/Class/KidilanguesLinkTest.php | 2 +- tests/library/Class/LeSocialLinkTest.php | 2 +- tests/library/Class/LieuTest.php | 4 +- tests/library/Class/ListesNoticesTest.php | 2 +- tests/library/Class/LocalisationTest.php | 2 +- tests/library/Class/MatiereTest.php | 6 +- tests/library/Class/MigrationTest.php | 2 +- tests/library/Class/ModelTestCase.php | 33 +- tests/library/Class/ModeleFusionTest.php | 2 +- tests/library/Class/NewsletterTest.php | 40 +-- tests/library/Class/Notice/ClefAlphaTest.php | 4 +- tests/library/Class/NoticeTest.php | 47 +-- tests/library/Class/PanierNoticeTest.php | 28 +- tests/library/Class/Profil/SkinTest.php | 2 +- .../Class/Profil/SkinUpdateReaderTest.php | 2 +- tests/library/Class/RemoteClientTest.php | 2 +- tests/library/Class/ScriptLoaderTest.php | 2 +- tests/library/Class/SitothequeTest.php | 2 +- tests/library/Class/StatsNoticesTest.php | 2 +- tests/library/Class/SuggestionAchatTest.php | 2 +- .../Class/Systeme/ModulesMenu/NumilogTest.php | 2 +- .../Systeme/ModulesMenu/VodeclicTest.php | 2 +- .../library/Class/Systeme/ModulesMenuTest.php | 4 +- .../Class/Systeme/PergameServiceTest.php | 31 +- .../library/Class/UserGroupCategorieTest.php | 6 +- tests/library/Class/UserGroupTest.php | 2 +- tests/library/Class/UsersTest.php | 287 +----------------- tests/library/Class/VodeclicLinkTest.php | 10 +- .../Class/WebService/Album/VignetteTest.php | 14 +- .../Class/WebService/CyberlibrisTest.php | 2 +- .../Class/WebService/MappedSoapClientTest.php | 2 +- .../Class/WebService/NumeriquePremiumTest.php | 2 +- .../WebService/Orphea/CatalogueParserTest.php | 6 +- .../Class/WebService/SIGB/BiblixNetTest.php | 4 +- .../Class/WebService/SIGB/CarthameTest.php | 2 +- .../Class/WebService/SIGB/CdScriptTest.php | 2 +- .../Class/WebService/SIGB/EmpruntTest.php | 2 +- .../Class/WebService/SIGB/ExemplaireTest.php | 6 +- .../WebService/SIGB/MicrobibServiceTest.php | 2 +- .../library/Class/WebService/SIGB/PMBTest.php | 2 +- .../Class/WebService/SIGB/VSmartTest.php | 14 +- .../WebService/WebAnalyticsClientTest.php | 10 +- tests/library/Class/WebkioskLinkTest.php | 16 +- tests/library/ZendAfi/Auth/TryHarderTest.php | 1 + tests/library/ZendAfi/AuthTest.php | 2 +- tests/library/ZendAfi/Form/LoginTest.php | 2 +- 82 files changed, 311 insertions(+), 634 deletions(-) diff --git a/cosmogramme/tests/php/classes/ModelTestCase.php b/cosmogramme/tests/php/classes/ModelTestCase.php index a20794e25a7..92cf19ee005 100644 --- a/cosmogramme/tests/php/classes/ModelTestCase.php +++ b/cosmogramme/tests/php/classes/ModelTestCase.php @@ -57,10 +57,10 @@ abstract class ModelTestCase extends PHPUnit_Framework_TestCase { $mock_results = $this->_buildRowset(array($fixture)); $this->_buildTableMock($model, array('find')) - ->expects($this->once()) - ->method('find') - ->with($id) - ->will($this->returnValue($mock_results)); + ->expects($this->once()) + ->method('find') + ->with($id) + ->will($this->returnValue($mock_results)); } @@ -68,6 +68,15 @@ abstract class ModelTestCase extends PHPUnit_Framework_TestCase { Storm_Model_Abstract::unsetLoaders(); if ($this->_storm_default_to_volatile) Storm_Model_Loader::defaultToVolatile(); + + Class_AdminVar::beVolatile(); + Class_AdminVar::set('CACHE_ACTIF', 0); + Class_AdminVar::set('NOM_DOMAINE', 'http://localhost'); + Class_AdminVar::set("AVIS_MIN_SAISIE", 0); + Class_AdminVar::set("AVIS_MAX_SAISIE", 100); + Class_Crypt::setPhpCommand($this->mock() + ->whenCalled('password_hash') + ->willDo(function($pass, $crypt) { return $pass; })); } @@ -75,6 +84,7 @@ abstract class ModelTestCase extends PHPUnit_Framework_TestCase { if($this->_storm_default_to_volatile) Storm_Model_Loader::defaultToDb(); Storm_Model_Abstract::unsetLoaders(); + Class_Crypt::setPhpCommand(null); } diff --git a/library/Class/Batch/BuildSiteMap.php b/library/Class/Batch/BuildSiteMap.php index 88ac67a32f1..8f968a535f6 100644 --- a/library/Class/Batch/BuildSiteMap.php +++ b/library/Class/Batch/BuildSiteMap.php @@ -29,6 +29,7 @@ class Class_Batch_BuildSiteMap extends Class_Batch_Abstract { public function run() { + xdebug_break(); $sitemap = new Class_Sitemap(); $profiles = $this->sitemapProfiles(); diff --git a/library/Class/Crypt.php b/library/Class/Crypt.php index 37684aa60f4..bfa0be3d613 100644 --- a/library/Class/Crypt.php +++ b/library/Class/Crypt.php @@ -20,7 +20,9 @@ */ -class Class_Crypt { +class Class_Crypt { + use Trait_StaticPhpCommand; + /** @see http://php.net/manual/en/function.crypt.php CRYPT_BLOWFISH section */ const BLOWFISH_PATTERN = '/^\$2[axy]\$[0-9]{2}\$/'; @@ -30,6 +32,6 @@ class Class_Crypt { public function blowFishHashOf($value) { - return password_hash($value, PASSWORD_BCRYPT); + return $this->getPhpCommand()->password_hash($value, PASSWORD_BCRYPT); } } diff --git a/library/Class/PanierNotice.php b/library/Class/PanierNotice.php index d7e6a55b18c..101e0e5b600 100644 --- a/library/Class/PanierNotice.php +++ b/library/Class/PanierNotice.php @@ -42,7 +42,7 @@ class PanierNoticeLoader extends Storm_Model_Loader { 'notices_paniers.id_user = bib_admin_users.id_user') ->where('bib_admin_users.ROLE_LEVEL >= ?', ZendAfi_Acl_AdminControllerRoles::MODO_BIB) ->order('notices_paniers.libelle'); - return $this->findAll($select); + return Class_PanierNotice::findAll($select); } diff --git a/library/Class/Testing/PhpCommand.php b/library/Class/Testing/PhpCommand.php index 4b44404aae3..a4137afc850 100644 --- a/library/Class/Testing/PhpCommand.php +++ b/library/Class/Testing/PhpCommand.php @@ -24,6 +24,7 @@ class Class_Testing_PhpCommand extends Class_Testing_FileSystem { $this->_known_functions = array_merge($this->_known_functions, ['rand', 'hash', + 'password_hash', 'extension_loaded', 'libxml_use_internal_errors', 'libxml_get_errors']); diff --git a/tests/application/modules/AbstractControllerTestCase.php b/tests/application/modules/AbstractControllerTestCase.php index 2d5ed7ae7de..43415f42576 100644 --- a/tests/application/modules/AbstractControllerTestCase.php +++ b/tests/application/modules/AbstractControllerTestCase.php @@ -125,60 +125,32 @@ abstract class AbstractControllerTestCase extends Zend_Test_PHPUnit_ControllerTe $session = new Zend_Session_Namespace('FlashMessenger'); $session->unsetAll(); - $admin_var_loader = Class_AdminVar::getLoader(); - $admin_var_loader - ->newInstanceWithId('WORKFLOW') - ->setValeur(0); - - - $admin_var_loader - ->newInstanceWithId('FORCE_HTTPS') - ->setValeur(0); - - $admin_var_loader - ->newInstanceWithId('TEXT_REPLACEMENTS') - ->setValeur(''); - + Class_AdminVar::beVolatile(); Class_TextReplacements::reset(); - - $admin_var_loader - ->newInstanceWithId('LANGUES') - ->setValeur(null); - - $admin_var_loader - ->newInstanceWithId('CACHE_ACTIF') - ->setValeur(0); - - $admin_var_loader - ->newInstanceWithId('BIBNUM') - ->setValeur(1); - - $admin_var_loader - ->newInstanceWithId('OAI_SERVER') - ->setValeur(1); - - $admin_var_loader - ->newInstanceWithId('PACK_MOBILE') - ->setValeur(1); - - $admin_var_loader - ->newInstanceWithId('CNIL_CONSENT_ENABLE') - ->setValeur(false); - - Class_AdminVar::newInstanceWithId('JS_STAT', ['valeur' => '']); + Class_AdminVar::set('CACHE_ACTIF', 0); + Class_AdminVar::set('BIBNUM', 1); + Class_AdminVar::set('OAI_SERVER', 1); + Class_AdminVar::set('PACK_MOBILE', 1); + Class_AdminVar::set('CNIL_CONSENT_ENABLE', false); + Class_AdminVar::set('NOM_DOMAINE', 'http://localhost'); + Class_AdminVar::set("AVIS_MIN_SAISIE", 0); + Class_AdminVar::set("AVIS_MAX_SAISIE", 100); + Class_AdminVar::set("FORCE_HTTPS", 0); ZendAfi_Controller_Action_Helper_TrackEvent::setDefaultWebAnalyticsClient(null); Storm_Cache::setDefaultZendCache(null); Class_WebService_AllServices::setHttpClient(null); Class_SessionActivityInscription::beVolatile(); Class_Url::setBaseUrl(BASE_URL); Class_Url::setPhpMode('apache'); - Class_AdminVar::set('NOM_DOMAINE', 'http://localhost'); + Class_Crypt::setPhpCommand($this->mock() + ->whenCalled('password_hash') + ->willDo(function($pass, $crypt) { return $pass; })); Class_WebService_BibNumerique_RessourceNumerique::setCommand($this->mock()->whenCalled('execTimedScript')->answers('')); } public function tearDown() { - if($this->_storm_default_to_volatile) { + if ($this->_storm_default_to_volatile) { Storm_Model_Loader::defaultToDb(); Class_Versions::defaultToFile(); } @@ -195,7 +167,6 @@ abstract class AbstractControllerTestCase extends Zend_Test_PHPUnit_ControllerTe ZendAfi_Form_Element_Captcha::reset(); Class_Url::setBaseUrl(null); Class_Url::setPhpMode(null); - Class_AdminVar::set('NOM_DOMAINE', ''); Class_Log::resetInstance(); Class_WebService_BibNumerique_Vignette::resetInstance(); Class_WebService_BibNumerique_Vignette::resetHttpClient(); @@ -206,6 +177,7 @@ abstract class AbstractControllerTestCase extends Zend_Test_PHPUnit_ControllerTe ZendAfi_Acl_AdminControllerGroup::setAcl(null); Class_Systeme_ModulesAccueil::reset(); Class_Album::setFileSystem(null); + Class_Crypt::setPhpCommand(null); } diff --git a/tests/application/modules/admin/controllers/ImportFichierCsvElectreTest.php b/tests/application/modules/admin/controllers/ImportFichierCsvElectreTest.php index 74ef60befab..4a9e1d0d65b 100644 --- a/tests/application/modules/admin/controllers/ImportFichierCsvElectreTest.php +++ b/tests/application/modules/admin/controllers/ImportFichierCsvElectreTest.php @@ -16,17 +16,19 @@ * * 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 ImportFichierCsvElectreThemeTest extends Storm_Test_ModelTestCase { +class ImportFichierCsvElectreThemeTest extends ModelTestCase { protected $_importTxt; protected $_file_contents; protected $file_writer; + protected $_storm_default_to_volatile = true; + public function setUp() { parent::setUp(); $this->importThesaurus = new Class_ImportFichierCsvThesaurus(); - + Storm_Test_ObjectWrapper::onLoaderOfModel('Class_CodifThesaurus') ->whenCalled('find') ->answers(null) @@ -57,14 +59,14 @@ class ImportFichierCsvElectreThemeTest extends Storm_Test_ModelTestCase { 'code' => '00010J000004', 'libelle' => 'Poésie' ], - + ]; } - /** + /** * @dataProvider expectedThesaurusCode - * @test + * @test */ public function getCodeAfiFromElectreShouldReturnLastNotEmptyLibelle($params, $code,$libelle) { $line=explode(';',$params['contents']); @@ -72,9 +74,9 @@ class ImportFichierCsvElectreThemeTest extends Storm_Test_ModelTestCase { $this->assertEquals($libelle,$this->importThesaurus->createCodifThesaurus($line,[3,2,2])->getLibelle()); } - /** + /** * @dataProvider expectedThesaurusCode - * @test + * @test */ public function getCodeAfiFromElectreShouldReturnCodeAfi($params, $code,$libelle) { $value=str_replace('"','',explode(';',$params['contents'])[0]); @@ -85,10 +87,12 @@ class ImportFichierCsvElectreThemeTest extends Storm_Test_ModelTestCase { } -class ImportFichierCsvElectrePublicTest extends Storm_Test_ModelTestCase { +class ImportFichierCsvElectrePublicTest extends ModelTestCase { protected $_importTxt; protected $_file_contents; protected $file_writer; + protected $_storm_default_to_volatile = true; + public function setUp() { parent::setUp(); $this->importThesaurus = new Class_ImportFichierCsvThesaurus(); @@ -100,18 +104,18 @@ class ImportFichierCsvElectrePublicTest extends Storm_Test_ModelTestCase { $this->importThesaurus->setCodeAndLibelleForThesaurus('thèmeelectre','Electre'); - + } public function expectedThesaurusCodePublic() { return [ [ - ['contents' => '"Tout public";"PG0000";"Grand public";;', + ['contents' => '"Tout public";"PG0000";"Grand public";;', 'sequence' => [2,2,2] ], 'code' => 'THEM00PG', 'libelle' => 'Grand public' - ], + ], [ ['contents' => '"Public débutant";"PS0302";"Public spécifique";"Autoformation";"Débutants"', 'sequence' => [2,2,2] ], @@ -140,9 +144,9 @@ class ImportFichierCsvElectrePublicTest extends Storm_Test_ModelTestCase { ]; } - /** + /** * @dataProvider expectedThesaurusCodePublic - * @test + * @test */ public function getCodeAfiFromElectrePublicShouldReturnLastNotEmptyLibelle($params, $code,$libelle) { $line=explode(';',$params['contents']); @@ -151,9 +155,9 @@ class ImportFichierCsvElectrePublicTest extends Storm_Test_ModelTestCase { } - /** + /** * @dataProvider expectedThesaurusCodePublic - * @test + * @test */ public function getCodifThesaurusFromThemeElectreShouldReturnCodeAfi($params, $code,$libelle) { @@ -163,18 +167,14 @@ class ImportFichierCsvElectrePublicTest extends Storm_Test_ModelTestCase { } - /** + /** * @dataProvider expectedThesaurusCodePublic - * @test + * @test */ public function getCodeAfiFromElectrePublicShouldReturnCodeAfi($params, $code,$libelle) { $value=str_replace('"','',explode(';',$params['contents'])[1]); - + $this->assertEquals($code,$this->importThesaurus->getCodeAfiFromElectre('THEM',$value,$params['sequence'])); } } - - - - diff --git a/tests/application/modules/admin/controllers/ImportFichierGenerationSiteTest.php b/tests/application/modules/admin/controllers/ImportFichierGenerationSiteTest.php index a2415a1147c..748efd20cbc 100644 --- a/tests/application/modules/admin/controllers/ImportFichierGenerationSiteTest.php +++ b/tests/application/modules/admin/controllers/ImportFichierGenerationSiteTest.php @@ -24,6 +24,7 @@ class ImportFichierGenerationSiteReadProfilTest extends ModelTestCase { protected $_importTxt; protected $_file_contents; protected $file_writer; + public function setUp() { parent::setUp(); @@ -223,12 +224,11 @@ class ImportFichierGenerationSiteReadProfilTest extends ModelTestCase { -class ImportFichierGenerationSiteDirectoryCreationReadProfilTest extends Storm_Test_ModelTestCase { +class ImportFichierGenerationSiteDirectoryCreationReadProfilTest extends ModelTestCase { protected $_importTxt; protected $file_writer; protected $profils; - - + protected $_storm_default_to_volatile = true; public function setUp() { parent::setUp(); diff --git a/tests/application/modules/admin/controllers/UsersControllerTest.php b/tests/application/modules/admin/controllers/UsersControllerTest.php index f8991c555b3..24ad7309159 100644 --- a/tests/application/modules/admin/controllers/UsersControllerTest.php +++ b/tests/application/modules/admin/controllers/UsersControllerTest.php @@ -968,6 +968,7 @@ class Admin_UsersControllerFormEditAdminTest extends Admin_UsersControllerEditAd class UsersControllerPostEditAdminTest extends Admin_UsersControllerEditAdminTestCase { public function setUp() { parent::setUp(); + Class_Crypt::setPhpCommand(null); $this->postDispatch('/admin/users/edit/id/10', ['login' => 'Tom', 'password' => 'tutu', 'nom' => 'Davis', diff --git a/tests/application/modules/opac/controllers/DomainsControllerTest.php b/tests/application/modules/opac/controllers/DomainsControllerTest.php index d93459c6cc7..b1349da1e09 100644 --- a/tests/application/modules/opac/controllers/DomainsControllerTest.php +++ b/tests/application/modules/opac/controllers/DomainsControllerTest.php @@ -37,6 +37,11 @@ abstract class DomainsControllerBrowseTestCase extends AbstractControllerTestCas 'root_domain_id' => 3 ]]); + $this->onLoaderOfModel('Class_Catalogue') + ->whenCalled('saveThesaurus') + ->answers(null); + + $this->fixture( 'Class_Catalogue', ['id' => 3, 'libelle' => 'Youth', 'url_img' => 'http://imgs/youth.png', diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 8276cf8b9da..bb3c8304f5c 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -90,6 +90,7 @@ $translate->setLocale('fr'); require_once 'tests/library/ZendAfi/View/Helper/ViewHelperTestCase.php'; require_once 'tests/application/modules/admin/controllers/AdminAbstractControllerTestCase.php'; +require_once 'tests/library/Class/ModelTestCase.php'; require_once 'tests/fixtures/RessourcesNumeriquesFixtures.php'; require_once 'tests/fixtures/MockedClasses.php'; require_once 'tests/application/modules/telephone/controllers/TelephoneAbstractControllerTestCase.php'; diff --git a/tests/library/Class/ActivityTest.php b/tests/library/Class/ActivityTest.php index 64657dd8516..4de26e043e8 100644 --- a/tests/library/Class/ActivityTest.php +++ b/tests/library/Class/ActivityTest.php @@ -19,9 +19,10 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -class ActivityJavaWithNoSessionTest extends Storm_Test_ModelTestCase { - public function setUp() { +class ActivityJavaWithNoSessionTest extends ModelTestCase { + protected $_storm_default_to_volatile = true; + public function setUp() { Class_Activity::setTimeSource(new TimeSourceForTest('2014-05-01 14:00:00')); $this->_learning_java = $this->fixture('Class_Activity', @@ -47,11 +48,13 @@ class ActivityJavaWithNoSessionTest extends Storm_Test_ModelTestCase { } -class ActivitySmalltalkWithTwoSessionsTest extends Storm_Test_ModelTestCase { +class ActivitySmalltalkWithTwoSessionsTest extends ModelTestCase { protected $_patrick_inscription; protected $_patrick; protected $_laurent; protected $_laurent_intervention; + protected $_storm_default_to_volatile = true; + public function setUp() { parent::setUp(); @@ -262,7 +265,7 @@ class ActivitySmalltalkWithTwoSessionsTest extends Storm_Test_ModelTestCase { -class ActivityHaskellWithTwoSessionsAccrossYearTest extends Storm_Test_ModelTestCase { +class ActivityHaskellWithTwoSessionsAccrossYearTest extends ModelTestCase { public function setUp() { $this->_learn_haskell = Class_Activity::getLoader() ->newInstanceWithId(5) diff --git a/tests/library/Class/AdminVarTest.php b/tests/library/Class/AdminVarTest.php index cbfc80e43c5..e8c96d6b8b0 100644 --- a/tests/library/Class/AdminVarTest.php +++ b/tests/library/Class/AdminVarTest.php @@ -124,7 +124,7 @@ class AdminVarTestSet extends AdminVarTestCase { -class AdminVarBabelthequeTest extends Storm_Test_ModelTestCase { +class AdminVarBabelthequeTest extends ModelTestCase { /** @test */ public function babelthequeIdShouldBeExtractedFromVarBabelthequeJS() { Class_AdminVar::newInstanceWithId('BABELTHEQUE_JS') @@ -145,7 +145,7 @@ class AdminVarBabelthequeTest extends Storm_Test_ModelTestCase { -class AdminVarWorkflowTest extends Storm_Test_ModelTestCase { +class AdminVarWorkflowTest extends ModelTestCase { public function setup() { parent::setup(); Class_AdminVar::beVolatile(); diff --git a/tests/library/Class/AgendaSQYImportTest.php b/tests/library/Class/AgendaSQYImportTest.php index f8eafbd9ddc..01afd22bf74 100644 --- a/tests/library/Class/AgendaSQYImportTest.php +++ b/tests/library/Class/AgendaSQYImportTest.php @@ -20,7 +20,7 @@ */ -class AgendaSQYImportTest extends Storm_Test_ModelTestCase { +class AgendaSQYImportTest extends ModelTestCase { protected static $_agenda, $_article_loader, diff --git a/tests/library/Class/Album/UsageConstraintTest.php b/tests/library/Class/Album/UsageConstraintTest.php index 8bb6b0967ab..9b80d76a916 100644 --- a/tests/library/Class/Album/UsageConstraintTest.php +++ b/tests/library/Class/Album/UsageConstraintTest.php @@ -18,7 +18,7 @@ * along with BOKEH; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -class Class_Album_UsageConstraintTest extends Storm_Test_ModelTestCase { +class Class_Album_UsageConstraintTest extends ModelTestCase { public function setUp() { parent::setUp(); diff --git a/tests/library/Class/AlbumRessource/LeafletTilesGeneratorTest.php b/tests/library/Class/AlbumRessource/LeafletTilesGeneratorTest.php index d0fbae813b4..6109bc010a2 100644 --- a/tests/library/Class/AlbumRessource/LeafletTilesGeneratorTest.php +++ b/tests/library/Class/AlbumRessource/LeafletTilesGeneratorTest.php @@ -16,10 +16,10 @@ * * 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 Class_AlbumRessource_LeafletTilesGeneratorTest extends Storm_Test_ModelTestCase { - protected +class Class_AlbumRessource_LeafletTilesGeneratorTest extends ModelTestCase { + protected $_convert_command, $_file_writer; @@ -64,28 +64,28 @@ class Class_AlbumRessource_LeafletTilesGeneratorTest extends Storm_Test_ModelTes public function withAlternateImageMagickPathShouldNotUseConvert() { Class_AlbumRessource_LeafletTilesGenerator::setImageMagickPath('/usr/local/bin/magick'); $this->_generator->ensureTilesGenerated(); - $this->assertContains('/usr/local/bin/magick ', + $this->assertContains('/usr/local/bin/magick ', $this->_mock_system_command->getFirstAttributeForLastCallOn('system')); } /** @test */ public function hugeImagePathShouldBeGivenToConvert() { - $this->assertContains('userfiles/album/3/big/media/huge_image.jpg ', + $this->assertContains('userfiles/album/3/big/media/huge_image.jpg ', $this->_convert_command); } - + /** @test */ public function filenameShouldContainsTilesPathDirectoryForZoomLevel5() { - $this->assertContains('-set filename:f "'.USERFILESPATH.'/album/3/tiles/98/5', + $this->assertContains('-set filename:f "'.USERFILESPATH.'/album/3/tiles/98/5', $this->_convert_command); } /** @test */ public function filenameShouldContainsTilesPathDirectoryForZoomLevel2() { - $this->assertContains('-set filename:f "'.USERFILESPATH.'/album/3/tiles/98/2', + $this->assertContains('-set filename:f "'.USERFILESPATH.'/album/3/tiles/98/2', $this->_convert_command); } diff --git a/tests/library/Class/AlbumTest.php b/tests/library/Class/AlbumTest.php index fe93e01af1b..d4d45974fc5 100644 --- a/tests/library/Class/AlbumTest.php +++ b/tests/library/Class/AlbumTest.php @@ -19,7 +19,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -abstract class AlbumHarlockTestCase extends Storm_Test_ModelTestCase { +abstract class AlbumHarlockTestCase extends ModelTestCase { /** @var Storm_Test_ObjectWrapper */ protected $_wrapper; @@ -694,7 +694,7 @@ class AlbumHarlockSortingResourcesTest extends AlbumHarlockTestCase { -class AlbumDeletingTestCase extends Storm_Test_ModelTestCase { +class AlbumDeletingTestCase extends ModelTestCase { protected $_storm_default_to_volatile = true; public function setUp() { diff --git a/tests/library/Class/ArteVodLinkTest.php b/tests/library/Class/ArteVodLinkTest.php index 691a0abd00e..90ccaf80a99 100644 --- a/tests/library/Class/ArteVodLinkTest.php +++ b/tests/library/Class/ArteVodLinkTest.php @@ -20,7 +20,7 @@ */ -class ArteVodLinkBaseUrlWithoutAlbumTest extends Storm_Test_ModelTestCase { +class ArteVodLinkBaseUrlWithoutAlbumTest extends ModelTestCase { public function setUp() { $this->fixture('Class_AdminVar', ['id' => 'ARTE_VOD_LOGIN', @@ -39,7 +39,7 @@ class ArteVodLinkBaseUrlWithoutAlbumTest extends Storm_Test_ModelTestCase { -class ArteVodLinkWithUserAndAlbumTest extends Storm_Test_ModelTestCase { +class ArteVodLinkWithUserAndAlbumTest extends ModelTestCase { protected $_james_bond; protected $_arte_vod_link; diff --git a/tests/library/Class/ArticleCategorieTest.php b/tests/library/Class/ArticleCategorieTest.php index 577bc2b52af..915c574512d 100644 --- a/tests/library/Class/ArticleCategorieTest.php +++ b/tests/library/Class/ArticleCategorieTest.php @@ -19,7 +19,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -class ArticleCategorieTest extends Storm_Test_ModelTestCase { +class ArticleCategorieTest extends ModelTestCase { public function setUp() { $this->annecy = Class_Bib::newInstanceWithId(21, ['libelle' => 'Annecy']); @@ -336,7 +336,7 @@ JSON; -class ArticleCategorieParentTest extends Storm_Test_ModelTestCase { +class ArticleCategorieParentTest extends ModelTestCase { protected $_news; public function setUp() { diff --git a/tests/library/Class/ArticleTest.php b/tests/library/Class/ArticleTest.php index 6968b19d22a..e773cd56764 100644 --- a/tests/library/Class/ArticleTest.php +++ b/tests/library/Class/ArticleTest.php @@ -19,7 +19,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -class ArticleWithTraductionsTest extends Storm_Test_ModelTestCase { +class ArticleWithTraductionsTest extends ModelTestCase { public function setUp() { $this->concert = Class_Article::getLoader() ->newInstanceWithId(4) @@ -368,7 +368,7 @@ class ArticleWithTraductionsTest extends Storm_Test_ModelTestCase { -class ArticleTestSmallArticle extends Storm_Test_ModelTestCase { +class ArticleTestSmallArticle extends ModelTestCase { /** @var Class_Article */ protected $_article; @@ -449,7 +449,7 @@ class ArticleTestSmallArticle extends Storm_Test_ModelTestCase { -class ArticleTestSummaryAndFullContentForArticleWithEndTag extends Storm_Test_ModelTestCase { +class ArticleTestSummaryAndFullContentForArticleWithEndTag extends ModelTestCase { /** @var Class_Article */ protected $_article; @@ -479,7 +479,7 @@ class ArticleTestSummaryAndFullContentForArticleWithEndTag extends Storm_Test_Mo -class ArticleTestSummaryAndFullContentForArticleWithDescription extends Storm_Test_ModelTestCase { +class ArticleTestSummaryAndFullContentForArticleWithDescription extends ModelTestCase { /** @var Class_Article */ protected $_article; @@ -525,7 +525,7 @@ class ArticleTestSummaryAndFullContentForArticleWithDescription extends Storm_Te -class ArticleTestSummaryAndFullContentForArticleWithEmptyDescription extends Storm_Test_ModelTestCase { +class ArticleTestSummaryAndFullContentForArticleWithEmptyDescription extends ModelTestCase { /** @var Class_Article */ protected $_article; @@ -562,7 +562,7 @@ class ArticleTestSummaryAndFullContentForArticleWithEmptyDescription extends Sto -class ArticleTestEmptyDates extends Storm_Test_ModelTestCase { +class ArticleTestEmptyDates extends ModelTestCase { /** @var Class_Article */ protected $_article; @@ -595,7 +595,7 @@ class ArticleTestEmptyDates extends Storm_Test_ModelTestCase { -class ArticleTestFutureStartDate extends Storm_Test_ModelTestCase { +class ArticleTestFutureStartDate extends ModelTestCase { /** @var Class_Article */ protected $_article; @@ -627,7 +627,7 @@ class ArticleTestFutureStartDate extends Storm_Test_ModelTestCase { -class ArticleTestPastStartDate extends Storm_Test_ModelTestCase { +class ArticleTestPastStartDate extends ModelTestCase { /** @var Class_Article */ protected $_article; @@ -661,7 +661,7 @@ class ArticleTestPastStartDate extends Storm_Test_ModelTestCase { -class ArticleTestFutureEndDate extends Storm_Test_ModelTestCase { +class ArticleTestFutureEndDate extends ModelTestCase { /** @var Class_Article */ protected $_article; @@ -700,7 +700,7 @@ class ArticleTestFutureEndDate extends Storm_Test_ModelTestCase { -class ArticleTestPastEndDate extends Storm_Test_ModelTestCase { +class ArticleTestPastEndDate extends ModelTestCase { /** @var Class_Article */ protected $_article; @@ -738,7 +738,7 @@ class ArticleTestPastEndDate extends Storm_Test_ModelTestCase { -class ArticleTestAllPastDates extends Storm_Test_ModelTestCase { +class ArticleTestAllPastDates extends ModelTestCase { /** @var Class_Article */ protected $_article; @@ -776,7 +776,7 @@ class ArticleTestAllPastDates extends Storm_Test_ModelTestCase { -class ArticleTestAllFutureDates extends Storm_Test_ModelTestCase { +class ArticleTestAllFutureDates extends ModelTestCase { /** @var Class_Article */ protected $_article; @@ -814,7 +814,7 @@ class ArticleTestAllFutureDates extends Storm_Test_ModelTestCase { -class ArticleTestDatesIncludesNow extends Storm_Test_ModelTestCase { +class ArticleTestDatesIncludesNow extends ModelTestCase { /** @var Class_Article */ protected $_article; @@ -986,7 +986,7 @@ class ArticleTestFixtures { -class EventsByMonthNoArticlesTest extends Storm_Test_ModelTestCase { +class EventsByMonthNoArticlesTest extends ModelTestCase { public function setup() { parent::setup(); @@ -1008,7 +1008,7 @@ class EventsByMonthNoArticlesTest extends Storm_Test_ModelTestCase { -abstract class EventsByMonthWithArticleTestCase extends Storm_Test_ModelTestCase { +abstract class EventsByMonthWithArticleTestCase extends ModelTestCase { protected $concert; public function setup() { diff --git a/tests/library/Class/Autocomplete/IndexTest.php b/tests/library/Class/Autocomplete/IndexTest.php index eb9a87dbb71..036b8246d75 100644 --- a/tests/library/Class/Autocomplete/IndexTest.php +++ b/tests/library/Class/Autocomplete/IndexTest.php @@ -16,11 +16,11 @@ * * 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 Class_Autocomplete_IndexTest extends Storm_Test_ModelTestCase{ +class Class_Autocomplete_IndexTest extends ModelTestCase{ protected $_file_system; public function setUp() { @@ -66,8 +66,8 @@ class Class_Autocomplete_IndexTest extends Storm_Test_ModelTestCase{ ]); $notice->save(); - - + + Class_Autocomplete_Index::indexRecordsTitle(); $this->assertEquals([$handle, "La jeune fille de Souleymane Cissé\n"],$this->_file_system->getAttributesForLastCallOn('fwrite')); } @@ -85,7 +85,7 @@ class Class_Autocomplete_IndexTest extends Storm_Test_ModelTestCase{ ['id' => 1301, 'titre_principal' => 'Bone of my bones', 'auteur_principal' => '']); - + Class_Autocomplete_Index::indexRecordsTitle(); $this->assertTrue( diff --git a/tests/library/Class/AvisNoticeTest.php b/tests/library/Class/AvisNoticeTest.php index 62cefbf1370..88885ed87c7 100644 --- a/tests/library/Class/AvisNoticeTest.php +++ b/tests/library/Class/AvisNoticeTest.php @@ -352,7 +352,7 @@ class AvisTestFindAllByUserAndClefOeuvreTestCase extends AvisTestFindAllTestCase -class NoticeTestHasManyAvisTest extends Storm_Test_ModelTestCase { +class NoticeTestHasManyAvisTest extends ModelTestCase { public function setUp() { $this->millenium = $this->fixture('Class_Notice', ['id' => 34, 'clef_oeuvre' => 'MILLENIUM--LARSSON']); @@ -789,7 +789,7 @@ class AvisVisibilityTest extends ModelTestCase { } -class AvisNoticeAvisFromPreferencesTest extends Storm_Test_ModelTestCase { +class AvisNoticeAvisFromPreferencesTest extends ModelTestCase { public function setUp() { parent::setUp(); Class_Users::beVolatile(); @@ -993,7 +993,7 @@ class AvisNoticeAvisFromPreferencesTest extends Storm_Test_ModelTestCase { -class AvisNoticeWithSameArtworkKeyTest extends Storm_Test_ModelTestCase { +class AvisNoticeWithSameArtworkKeyTest extends ModelTestCase { public function setUp() { parent::setUp(); diff --git a/tests/library/Class/AvisTest.php b/tests/library/Class/AvisTest.php index 337f745819b..500a0609268 100644 --- a/tests/library/Class/AvisTest.php +++ b/tests/library/Class/AvisTest.php @@ -16,13 +16,13 @@ * * 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 AvisCmsOnArticleConcertTest extends Storm_Test_ModelTestCase { - protected - $_concert, - $_laurent, +class AvisCmsOnArticleConcertTest extends ModelTestCase { + protected + $_concert, + $_laurent, $_avis_laurent; @@ -55,7 +55,7 @@ class AvisCmsOnArticleConcertTest extends Storm_Test_ModelTestCase { $this->assertEquals($this->_concert, $this->_avis_laurent->getArticle()); } - + /** @test */ public function laurentGetAvisArticleShouldAnswersArrayWithAvisLaurent() { $this->assertEquals([$this->_avis_laurent], $this->_laurent->getAvisArticles()); diff --git a/tests/library/Class/BatchTest.php b/tests/library/Class/BatchTest.php index 9b52b311979..968813261b7 100644 --- a/tests/library/Class/BatchTest.php +++ b/tests/library/Class/BatchTest.php @@ -21,7 +21,7 @@ include_once('tests/fixtures/HarvestOrpheaFixtures.php'); include_once('tests/fixtures/RessourcesNumeriquesFixtures.php'); -class BatchModelTest extends Storm_Test_ModelTestCase { +class BatchModelTest extends ModelTestCase { public function setUp(){ parent::setUp(); $this->moissonage_vodeclic = $this->fixture('Class_Batch', @@ -99,7 +99,7 @@ class BatchModelTest extends Storm_Test_ModelTestCase { -class BatchLoaderWithoutRessourcesNumeriquesTest extends Storm_Test_ModelTestCase { +class BatchLoaderWithoutRessourcesNumeriquesTest extends ModelTestCase { public function setUp() { parent::setUp(); @@ -121,7 +121,7 @@ class BatchLoaderWithoutRessourcesNumeriquesTest extends Storm_Test_ModelTestCas -class BatchIndexRessourcesNumeriquesTest extends Storm_Test_ModelTestCase { +class BatchIndexRessourcesNumeriquesTest extends ModelTestCase { public function setUp() { $album = $this->fixture('Class_Album', ['id' => 1, 'titre' => 'Mon Album', @@ -151,12 +151,14 @@ class BatchIndexRessourcesNumeriquesTest extends Storm_Test_ModelTestCase { -class BatchBuildSitemapTest extends Storm_Test_ModelTestCase { +class BatchBuildSitemapTest extends ModelTestCase { protected $_file_system; protected $_profiles; public function setUp() { parent::setup(); + Class_AdminVar::set('NOM_DOMAINE', 'wiki.bokeh-library-portal.org'); + Class_Url::setPhpMode('cli'); Zend_Controller_Front::getInstance()->setRouter(new ZendAfi_Controller_Router_RewriteWithoutBaseUrl()); @@ -176,8 +178,6 @@ class BatchBuildSitemapTest extends Storm_Test_ModelTestCase { 'cfg_accueil' => ZendAfi_Filters_Serialize::serialize(['sitemap' => 1]), 'rewrite_url' => 'my-url']); - Class_Profil::beVolatile(); - $this->handle = new stdClass; $this->_file_system = $this->mock() ->whenCalled('fopen')->with(ROOT_PATH.'temp/sitemap.xml', 'w')->answers($this->handle) @@ -185,11 +185,6 @@ class BatchBuildSitemapTest extends Storm_Test_ModelTestCase { ->whenCalled('unlink')->answers(null); Class_Sitemap::setFileSystem($this->_file_system); - - $this->fixture('Class_AdminVar', ['id' => 'NOM_DOMAINE', - 'clef' => 'NOM_DOMAINE', - 'valeur' => 'wiki.bokeh-library-portal.org']); - } @@ -215,6 +210,11 @@ class BatchBuildSitemapTest extends Storm_Test_ModelTestCase { </url> </urlset> '; + $this->assertTrue($this->_file_system + ->methodHasBeenCalled('fwrite')); + + $this->assertEquals($expected, + $this->_file_system->getAttributesForLastCallOn('fwrite')[1]); $this->assertTrue($this->_file_system ->methodHasBeenCalledWithParams('fwrite', diff --git a/tests/library/Class/BibTest.php b/tests/library/Class/BibTest.php index 67d6ab59441..45765a3194c 100644 --- a/tests/library/Class/BibTest.php +++ b/tests/library/Class/BibTest.php @@ -19,7 +19,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -class BibTest extends Storm_Test_ModelTestCase { +class BibTest extends ModelTestCase { /** @test */ function loaderFindAllWithPortailShouldIncludePortail() { $this->assertEquals(0, @@ -93,7 +93,7 @@ class BibTest extends Storm_Test_ModelTestCase { -class BibFindAllWithPortailTest extends Storm_Test_ModelTestCase { +class BibFindAllWithPortailTest extends ModelTestCase { protected $_storm_default_to_volatile = true; diff --git a/tests/library/Class/CatalogueTest.php b/tests/library/Class/CatalogueTest.php index d151e884fa0..f170b7b29e7 100644 --- a/tests/library/Class/CatalogueTest.php +++ b/tests/library/Class/CatalogueTest.php @@ -80,7 +80,7 @@ class CatalogueTestGetRequetesPanierWithIdUserAndIdPanier extends ModelTestCase } -class CatalogueTestGetRequetesPanierWithIdUserAndIdPanierUsedForId extends Storm_Test_ModelTestCase { +class CatalogueTestGetRequetesPanierWithIdUserAndIdPanierUsedForId extends ModelTestCase { public function setUp() { parent::setUp(); @@ -738,7 +738,7 @@ class CatalogueParentTest extends ModelTestCase { } -class CatalogueBuildCriteresRechercheTest extends Storm_Test_ModelTestCase { +class CatalogueBuildCriteresRechercheTest extends ModelTestCase { public function setUp() { parent::setUp(); diff --git a/tests/library/Class/CodificationTest.php b/tests/library/Class/CodificationTest.php index 4dde45a9915..8d6f67078bf 100644 --- a/tests/library/Class/CodificationTest.php +++ b/tests/library/Class/CodificationTest.php @@ -19,7 +19,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -class CodificationNomChampsTest extends Storm_Test_ModelTestCase { +class CodificationNomChampsTest extends ModelTestCase { public function setUp() { parent::setUp(); $this->old_sql = Zend_Registry::get('sql'); diff --git a/tests/library/Class/DecodageUnimarcTest.php b/tests/library/Class/DecodageUnimarcTest.php index ef36a23da20..d306b3aa18b 100644 --- a/tests/library/Class/DecodageUnimarcTest.php +++ b/tests/library/Class/DecodageUnimarcTest.php @@ -20,7 +20,7 @@ */ -class DecodageUnimarcDVDLaJeuneFilleTest extends Storm_Test_ModelTestCase { +class DecodageUnimarcDVDLaJeuneFilleTest extends ModelTestCase { public function setUp() { parent::setUp(); Class_CodifLangue::getLoader() @@ -311,7 +311,7 @@ class DecodageUnimarcConcertoAuteursTest extends PHPUnit_Framework_TestCase { } -class DecodageUnimarcDVDUnHerosTresDiscretTest extends Storm_Test_ModelTestCase { +class DecodageUnimarcDVDUnHerosTresDiscretTest extends ModelTestCase { protected $_storm_default_to_volatile = true; @@ -390,7 +390,7 @@ class DecodageUnimarcDVDUnHerosTresDiscretTest extends Storm_Test_ModelTestCase -class DecodageUnimarcCDKayaTest extends Storm_Test_ModelTestCase { +class DecodageUnimarcCDKayaTest extends ModelTestCase { protected $_storm_default_to_volatile = true; @@ -437,7 +437,7 @@ class DecodageUnimarcCDKayaTest extends Storm_Test_ModelTestCase { -class DecodageUnimarcVieDAdeleTest extends Storm_Test_ModelTestCase { +class DecodageUnimarcVieDAdeleTest extends ModelTestCase { protected $_storm_default_to_volatile = true; diff --git a/tests/library/Class/DuplicateInProfilTest.php b/tests/library/Class/DuplicateInProfilTest.php index a6ab5a18e25..bb1cfa7e450 100644 --- a/tests/library/Class/DuplicateInProfilTest.php +++ b/tests/library/Class/DuplicateInProfilTest.php @@ -19,7 +19,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -abstract class DuplicateInProfilTestCase extends Storm_Test_ModelTestCase { +abstract class DuplicateInProfilTestCase extends ModelTestCase { protected $current_profil; public function setUp() { diff --git a/tests/library/Class/DynamicUserGroupTest.php b/tests/library/Class/DynamicUserGroupTest.php index 1511e5f9624..97a9b32bc0b 100644 --- a/tests/library/Class/DynamicUserGroupTest.php +++ b/tests/library/Class/DynamicUserGroupTest.php @@ -20,7 +20,7 @@ */ -abstract class DynamicUserGroupTestCase extends Storm_Test_ModelTestCase { +abstract class DynamicUserGroupTestCase extends ModelTestCase { public function setUp() { parent::setUp(); Storm_Model_Loader::defaultToVolatile(); diff --git a/tests/library/Class/EADTest.php b/tests/library/Class/EADTest.php index 1997395b173..1f4386d6c8e 100644 --- a/tests/library/Class/EADTest.php +++ b/tests/library/Class/EADTest.php @@ -52,7 +52,7 @@ class EADFolioMoulinsTest extends PHPUnit_Framework_TestCase { -class EADEmptyLoadTest extends Storm_Test_ModelTestCase { +class EADEmptyLoadTest extends ModelTestCase { protected $_ead; public function setUp() { @@ -489,7 +489,7 @@ class EADMoulinsTest extends PHPUnit_Framework_TestCase { -class EADIndexationParDefautTest extends Storm_Test_ModelTestCase { +class EADIndexationParDefautTest extends ModelTestCase { public function setUp() { parent::setUp(); diff --git a/tests/library/Class/ExemplaireTest.php b/tests/library/Class/ExemplaireTest.php index be2fd7d1582..4c0301fe817 100644 --- a/tests/library/Class/ExemplaireTest.php +++ b/tests/library/Class/ExemplaireTest.php @@ -16,11 +16,11 @@ * * 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 Class_ExemplaireTest extends Storm_Test_ModelTestCase { +class Class_ExemplaireTest extends ModelTestCase { public function setUp() { parent::setUp(); @@ -51,10 +51,10 @@ class Class_ExemplaireTest extends Storm_Test_ModelTestCase { $exemplaire = Class_Exemplaire::newInstanceWithId(34, ['notice'=>Class_Notice::newInstanceWithId(12), 'int_bib'=>$int_bib]); - + $this->assertFalse($exemplaire->isReservable()); } - + /** @test */ public function exemplaireIsSigbExemplaireAndIsReservableShouldBeReservable() { $sigb_exemplaire= Storm_Test_ObjectWrapper::mock() diff --git a/tests/library/Class/FRBR/LinkTest.php b/tests/library/Class/FRBR/LinkTest.php index 9969a3b82ba..495ff07dbc1 100644 --- a/tests/library/Class/FRBR/LinkTest.php +++ b/tests/library/Class/FRBR/LinkTest.php @@ -19,7 +19,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -class FRBR_LinkWrongAttributesTest extends Storm_Test_ModelTestCase { +class FRBR_LinkWrongAttributesTest extends ModelTestCase { public function setUp() { parent::setUp(); diff --git a/tests/library/Class/FormulaireTest.php b/tests/library/Class/FormulaireTest.php index bf1a383e0fc..a33240d84b6 100644 --- a/tests/library/Class/FormulaireTest.php +++ b/tests/library/Class/FormulaireTest.php @@ -16,10 +16,10 @@ * * 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 FormulaireTest extends Storm_Test_ModelTestCase { +class FormulaireTest extends ModelTestCase { public function setUp() { parent::setUp(); $this->_jessy = Class_Users::newInstanceWithId(77, ['login' => 'Jessy']); @@ -42,14 +42,14 @@ class FormulaireTest extends Storm_Test_ModelTestCase { /** @test */ public function userFantomasShouldHaveOneFormulaire() { - $this->assertEquals([$this->_formulaire], + $this->assertEquals([$this->_formulaire], $this->_fantomas->getFormulaires()); } /** @test */ public function articleShouldHaveOneFormulaire() { - $this->assertEquals([$this->_formulaire], + $this->assertEquals([$this->_formulaire], $this->_article->getFormulaires()); } diff --git a/tests/library/Class/GlobalSqlRefactoringTest.php b/tests/library/Class/GlobalSqlRefactoringTest.php index 1ca5e210428..e69f8f6a2fb 100644 --- a/tests/library/Class/GlobalSqlRefactoringTest.php +++ b/tests/library/Class/GlobalSqlRefactoringTest.php @@ -19,7 +19,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -class GlobalSqlRefactoringTest extends Storm_Test_ModelTestCase { +class GlobalSqlRefactoringTest extends ModelTestCase { protected $_old_sql; public function setUp() { diff --git a/tests/library/Class/IntBibTest.php b/tests/library/Class/IntBibTest.php index 61374f19545..47358fd439e 100644 --- a/tests/library/Class/IntBibTest.php +++ b/tests/library/Class/IntBibTest.php @@ -20,7 +20,7 @@ */ -class IntBibTest extends Storm_Test_ModelTestCase { +class IntBibTest extends ModelTestCase { public function setUp() { parent::setUp(); $this->fixture('Class_IntBib', ['id' => 3, @@ -51,7 +51,7 @@ class IntBibTest extends Storm_Test_ModelTestCase { -class IntBibSingleNanookTest extends Storm_Test_ModelTestCase { +class IntBibSingleNanookTest extends ModelTestCase { protected $_storm_default_to_volatile = true, $_id_int_bib; diff --git a/tests/library/Class/KidilanguesLinkTest.php b/tests/library/Class/KidilanguesLinkTest.php index d6b6bfdbae8..7865f6b9a73 100644 --- a/tests/library/Class/KidilanguesLinkTest.php +++ b/tests/library/Class/KidilanguesLinkTest.php @@ -22,7 +22,7 @@ include_once('tests/fixtures/RessourcesNumeriquesFixtures.php'); -abstract class KidilanguesLinkTestCase extends Storm_Test_ModelTestCase { +abstract class KidilanguesLinkTestCase extends ModelTestCase { public function setUp() { parent::setUp(); Storm_Model_Loader::defaultToVolatile(); diff --git a/tests/library/Class/LeSocialLinkTest.php b/tests/library/Class/LeSocialLinkTest.php index 033525a51be..d84a4c0c5e2 100644 --- a/tests/library/Class/LeSocialLinkTest.php +++ b/tests/library/Class/LeSocialLinkTest.php @@ -20,7 +20,7 @@ */ -class LeSocialLinkTest extends Storm_Test_ModelTestCase { +class LeSocialLinkTest extends ModelTestCase { protected $link; protected $_storm_default_to_volatile = true; protected $user; diff --git a/tests/library/Class/LieuTest.php b/tests/library/Class/LieuTest.php index d247e3f7527..c9e7a7aa1a3 100644 --- a/tests/library/Class/LieuTest.php +++ b/tests/library/Class/LieuTest.php @@ -16,11 +16,11 @@ * * 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 LieuTest extends Storm_Test_ModelTestCase { +class LieuTest extends ModelTestCase { /** @test */ public function lieuShouldNotBeValidWithoutLibelle() { diff --git a/tests/library/Class/ListesNoticesTest.php b/tests/library/Class/ListesNoticesTest.php index 15f053061e6..5b1f3665e82 100644 --- a/tests/library/Class/ListesNoticesTest.php +++ b/tests/library/Class/ListesNoticesTest.php @@ -19,7 +19,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -class ListesNoticesTest extends Storm_Test_ModelTestCase { +class ListesNoticesTest extends ModelTestCase { protected $_original_sql, $_mock_sql; public function setUp() { diff --git a/tests/library/Class/LocalisationTest.php b/tests/library/Class/LocalisationTest.php index ef9eabc9c23..bc273289f43 100644 --- a/tests/library/Class/LocalisationTest.php +++ b/tests/library/Class/LocalisationTest.php @@ -20,7 +20,7 @@ */ -class LocalisationTest extends Storm_Test_ModelTestCase { +class LocalisationTest extends ModelTestCase { public function setUp() { parent::setUp(); diff --git a/tests/library/Class/MatiereTest.php b/tests/library/Class/MatiereTest.php index 8845359f0ea..ac5a03ca8be 100644 --- a/tests/library/Class/MatiereTest.php +++ b/tests/library/Class/MatiereTest.php @@ -16,16 +16,16 @@ * * 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 MatiereTest extends Storm_Test_ModelTestCase { +class MatiereTest extends ModelTestCase { /** @test */ function sqlQueriesShouldBeEscaped() { Storm_Test_ObjectWrapper::onLoaderOfModel('Class_Matiere') ->whenCalled('findAllBy') ->with(array('where' => 'libelle LIKE \'L\'\'art du 20ème : %\'')) - ->answers(array(Class_Matiere::getLoader()->newInstanceWithId(12), + ->answers(array(Class_Matiere::getLoader()->newInstanceWithId(12), Class_Matiere::getLoader()->newInstanceWithId(24))); $matiere = Class_Matiere::getLoader() diff --git a/tests/library/Class/MigrationTest.php b/tests/library/Class/MigrationTest.php index d2ed1de46e9..c3492169e1e 100644 --- a/tests/library/Class/MigrationTest.php +++ b/tests/library/Class/MigrationTest.php @@ -19,7 +19,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -abstract class MigrationTestCase extends Storm_Test_ModelTestCase { +abstract class MigrationTestCase extends ModelTestCase { protected $_old_sql; public function setUp() { diff --git a/tests/library/Class/ModelTestCase.php b/tests/library/Class/ModelTestCase.php index 49b6b6aee44..6f996ab370f 100644 --- a/tests/library/Class/ModelTestCase.php +++ b/tests/library/Class/ModelTestCase.php @@ -40,7 +40,7 @@ abstract class ModelTestCase extends Storm_Test_ModelTestCase { use Storm_Test_THelpers; protected - $_storm_default_to_volatile = false, + $_storm_default_to_volatile = true, $_registry_sql; @@ -57,17 +57,6 @@ abstract class ModelTestCase extends Storm_Test_ModelTestCase { } - protected function _setFindExpectation($model, $fixture, $id) { - $mock_results = $this->_buildRowset([$fixture]); - - $this->_buildTableMock($model, ['find']) - ->expects($this->once()) - ->method('find') - ->with($id) - ->will($this->returnValue($mock_results)); - } - - protected function setUp() { Storm_Model_Abstract::unsetLoaders(); if($this->_storm_default_to_volatile) { @@ -78,9 +67,27 @@ abstract class ModelTestCase extends Storm_Test_ModelTestCase { $this->_registry_sql = Zend_Registry::get('sql'); Class_Url::setBaseUrl('/bokeh'); Class_Url::setPhpMode('apache'); + + Class_AdminVar::beVolatile(); + Class_AdminVar::set('CACHE_ACTIF', 0); + Class_AdminVar::set('BIBNUM', 1); + Class_AdminVar::set('OAI_SERVER', 1); + Class_AdminVar::set('PACK_MOBILE', 1); + Class_AdminVar::set('CNIL_CONSENT_ENABLE', false); Class_AdminVar::set('NOM_DOMAINE', 'http://localhost'); + Class_AdminVar::set("AVIS_MIN_SAISIE", 0); + Class_AdminVar::set("AVIS_MAX_SAISIE", 100); + Class_AdminVar::set("FORCE_HTTPS", 0); + Class_AdminVar::set('NOM_DOMAINE', 'http://localhost'); + Class_Crypt::setPhpCommand($this->mock() + ->whenCalled('password_hash') + ->willDo(function($pass, $crypt) { return $pass; })); Class_WebService_BibNumerique_RessourceNumerique::setCommand($this->mock() ->whenCalled('execTimedScript')->answers('')); + + $this->fixture('Class_CodifLangue', + ['id' => 'fre', + 'libelle' => 'français']); } @@ -89,8 +96,8 @@ abstract class ModelTestCase extends Storm_Test_ModelTestCase { Class_Notice_Thumbnail_ResizeImage::reset(); Class_Album::setFileSystem(null); Class_FileManager::reset(); - Class_AdminVar::set('NOM_DOMAINE', ''); Class_MoteurRecherche::resetInstance(); + Class_Crypt::setPhpCommand(null); if($this->_storm_default_to_volatile) { Storm_Model_Loader::defaultToDb(); diff --git a/tests/library/Class/ModeleFusionTest.php b/tests/library/Class/ModeleFusionTest.php index aeba8cbe0df..5d5e95c1c75 100644 --- a/tests/library/Class/ModeleFusionTest.php +++ b/tests/library/Class/ModeleFusionTest.php @@ -19,7 +19,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -class ModeleFusionWithSessionActivityAndBibTest extends Storm_Test_ModelTestCase { +class ModeleFusionWithSessionActivityAndBibTest extends ModelTestCase { public function setUp() { parent::setUp(); diff --git a/tests/library/Class/NewsletterTest.php b/tests/library/Class/NewsletterTest.php index 34add2827a3..35e0c754c1d 100644 --- a/tests/library/Class/NewsletterTest.php +++ b/tests/library/Class/NewsletterTest.php @@ -18,33 +18,28 @@ * along with BOKEH; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -require_once 'Class/Newsletter.php'; -require_once 'ModelTestCase.php'; - -class NewsletterFixture { - public static function nouveautesClassique() { - return array('id' => 1, - 'titre' => 'Nouveautés classique', - 'contenu' => 'Notre sélection du mois'); - } +abstract class NewsletterTestCase extends ModelTestCase { + public function setUp() { + parent::setUp(); - public static function animations() { - return array('id' => 2, - 'titre' => 'Animations', - 'contenu' => 'Pour les jeunes'); - } + $this->fixture('Class_Newsletter', + ['id' => 1, + 'titre' => 'Nouveautés classique', + 'contenu' => 'Notre sélection du mois']); - public static function all() { - return array(self::nouveautesClassique(), - self::animations()); + $this->fixture('Class_Newsletter', + ['id' => 2, + 'titre' => 'Animations', + 'contenu' => 'Pour les jeunes']); } } -class NewsletterTestFindAll extends ModelTestCase { + + +class NewsletterTestFindAll extends NewsletterTestCase { public function setUp() { parent::setUp(); - $this->_setFindAllExpectation('Class_Newsletter', NewsletterFixture::all()); $this->newsletters = Class_Newsletter::getLoader()->findAll(); } @@ -67,16 +62,14 @@ class NewsletterTestFindAll extends ModelTestCase { -class NewsletterTestFindById extends ModelTestCase { +class NewsletterTestFindById extends NewsletterTestCase { public function testFindByIdOneReturnsNouveautes() { - $this->_setFindExpectation('Class_Newsletter', NewsletterFixture::nouveautesClassique(), 1); $nouveaute = Class_Newsletter::getLoader()->find(1); $this->assertEquals(1, $nouveaute->getId()); } public function testFindByIdTwoReturnsAnimations() { - $this->_setFindExpectation('Class_Newsletter', NewsletterFixture::animations(), 2); $animations = Class_Newsletter::getLoader()->find(2); $this->assertEquals(2, $animations->getId()); } @@ -84,11 +77,10 @@ class NewsletterTestFindById extends ModelTestCase { -class NewsletterTimeSourceTest extends ModelTestCase { +class NewsletterTimeSourceTest extends NewsletterTestCase { public function setup() { parent::setup(); - $this->now = new TimeSourceForTest('2014-05-28 23:59:00'); Class_Newsletter::setTimeSource($this->now); $this->fixture('Class_Newsletter', diff --git a/tests/library/Class/Notice/ClefAlphaTest.php b/tests/library/Class/Notice/ClefAlphaTest.php index 4990e887a55..f016c38c8ee 100644 --- a/tests/library/Class/Notice/ClefAlphaTest.php +++ b/tests/library/Class/Notice/ClefAlphaTest.php @@ -19,7 +19,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -class Notice_ClefAlphaSusAImprevuTest extends Storm_Test_ModelTestCase { +class Notice_ClefAlphaSusAImprevuTest extends ModelTestCase { public function setUp() { parent::setUp(); $this->_clef = new Class_Notice_ClefAlpha('SUSALIMPREVU--BOUCQF-2-LELOMBARD-2012-1'); @@ -81,7 +81,7 @@ class Notice_ClefAlphaSusAImprevuTest extends Storm_Test_ModelTestCase { -class Notice_ClefAlphaOnPseudoNoticeTest extends Storm_Test_ModelTestCase { +class Notice_ClefAlphaOnPseudoNoticeTest extends ModelTestCase { public function expectedAlphaKeysForModels() { return [ diff --git a/tests/library/Class/NoticeTest.php b/tests/library/Class/NoticeTest.php index 7cb97599006..b667eb73bb1 100644 --- a/tests/library/Class/NoticeTest.php +++ b/tests/library/Class/NoticeTest.php @@ -18,22 +18,6 @@ * along with BOKEH; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -require_once 'Class/Notice.php'; -require_once 'ModelTestCase.php'; - -class NoticeFixtures extends TestFixtures { - protected $_fixtures = ['millenium' => ['id_notice' => 12, - 'titres' => 'MILLENIUM'], - 'potter' => ['id_notice' => 48, - 'titres' => 'POTTER']]; - - public static function instance() { - return new self(); - } -} - - - class NoticeVignetteTest extends ModelTestCase { protected $_storm_default_to_volatile = true; @@ -422,31 +406,6 @@ class NoticeVignetteTest extends ModelTestCase { -class NoticeTestFindAll extends ModelTestCase { - public function setUp() { - parent::setUp(); - $this->_setFindAllExpectation('Class_Notice', 'NoticeFixtures'); - $this->notices = Class_Notice::getLoader()->findAll(); - } - - public function testFirstIsMillenium() { - $millenium = $this->notices[0]; - $this->assertEquals(12, $millenium->getIdNotice()); - $this->assertEquals(12, $millenium->getId()); - $this->assertEquals('MILLENIUM', $millenium->getTitres()); - } - - public function testSecondPotter() { - $potter = $this->notices[1]; - $this->assertEquals(48, $potter->getIdNotice()); - $this->assertEquals(48, $potter->getId()); - $this->assertEquals('POTTER', $potter->getTitres()); - } -} - - - - class NoticeTestTypeDoc extends ModelTestCase { public function setUp() { parent::setUp(); @@ -609,7 +568,7 @@ class NoticeTestTranslator extends ModelTestCase { -abstract class NoticeThirdPartyTracksTestCase extends Storm_Test_ModelTestCase { +abstract class NoticeThirdPartyTracksTestCase extends ModelTestCase { protected $_tracks, $_result; public function setUp() { @@ -745,7 +704,7 @@ class NoticeGamTest extends NoticeThirdPartyTracksTestCase { -class NoticeStromaeTest extends Storm_Test_ModelTestCase { +class NoticeStromaeTest extends ModelTestCase { protected $_tracks, $_output, $_temp_file, $_direcrectory_definition_length; public function setUp() { @@ -946,7 +905,7 @@ class NoticeWithSerialArticleTest extends AbstractControllerTestCase { -class NoticeGetChampNoticeTest extends Storm_Test_ModelTestCase { +class NoticeGetChampNoticeTest extends ModelTestCase { protected $_storm_default_to_volatile = true, $_record, $_facets; diff --git a/tests/library/Class/PanierNoticeTest.php b/tests/library/Class/PanierNoticeTest.php index bee262b2c61..aff31c8a079 100644 --- a/tests/library/Class/PanierNoticeTest.php +++ b/tests/library/Class/PanierNoticeTest.php @@ -18,9 +18,11 @@ * along with BOKEH; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -require_once 'ModelTestCase.php'; class PanierNoticeLoaderTestFindAllBelongsToAdmin extends ModelTestCase { + protected + $_storm_default_to_volatile = false; + public function setUp() { parent::setUp(); @@ -46,6 +48,7 @@ class PanierNoticeLoaderTestFindAllBelongsToAdmin extends ModelTestCase { $this->paniers = Class_PanierNotice::getLoader()->findAllBelongsToAdmin(); } + public function testQuery() { $this->assertEquals("SELECT `notices_paniers`.*, `bib_admin_users`.* FROM `notices_paniers`\n ". "INNER JOIN `bib_admin_users` ON notices_paniers.id_user = bib_admin_users.id_user WHERE (bib_admin_users.ROLE_LEVEL >= 3) ORDER BY `notices_paniers`.`libelle` ASC", @@ -244,17 +247,15 @@ class PanierNoticeWithThreeNoticesTest extends ModelTestCase { -class PanierNoticeAssociatedToCatalogueTest extends Storm_Test_ModelTestCase { +class PanierNoticeAssociatedToCatalogueTest extends ModelTestCase { protected $_fictions, $_catalogue_films, - $_assoc_fictions_films, - $_catalogue_cinema, - $_old_sql; + $_catalogue_cinema; public function setUp() { parent::setUp(); - $this->_old_sql = Zend_Registry::get('sql'); + Zend_Registry::set('sql', $this->mock() ->whenCalled('query')->answers(true)); @@ -268,17 +269,7 @@ class PanierNoticeAssociatedToCatalogueTest extends Storm_Test_ModelTestCase { $this->_fictions->setCatalogues([$this->_catalogue_films])->save(); - $this->_catalogue_cinema->setSousDomaines([$this->_catalogue_films]); - - $this->_assoc_fictions_films = $this->fixture('Class_PanierNoticeCatalogue', ['id' =>19, - 'id_panier' => 4, - 'id_catalogue' => 6]); - } - - - public function tearDown() { - Zend_Registry::set('sql', $this->_old_sql); - parent::tearDown(); + $this->_catalogue_cinema->setSousDomaines([$this->_catalogue_films])->save(); } @@ -290,6 +281,7 @@ class PanierNoticeAssociatedToCatalogueTest extends Storm_Test_ModelTestCase { /** @test */ public function catalogueFilmsShouldHavePanierFictions() { + $paniers = $this->_catalogue_films->getPanierNotices(); $this->assertEquals([$this->_fictions], $this->_catalogue_films->getPanierNotices()); } @@ -316,7 +308,7 @@ class PanierNoticeAssociatedToCatalogueTest extends Storm_Test_ModelTestCase { -class NewPanierNoticeForUserTest extends Storm_Test_ModelTestCase { +class NewPanierNoticeForUserTest extends ModelTestCase { public function setUp() { parent::setUp(); $this->tom = $this->fixture('Class_Users', ['id'=>4, diff --git a/tests/library/Class/Profil/SkinTest.php b/tests/library/Class/Profil/SkinTest.php index 98ddd089603..9214c2ae325 100644 --- a/tests/library/Class/Profil/SkinTest.php +++ b/tests/library/Class/Profil/SkinTest.php @@ -19,7 +19,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -abstract class Class_Profil_SkinTestCase extends Storm_Test_ModelTestCase { +abstract class Class_Profil_SkinTestCase extends ModelTestCase { protected $_skin; protected $_file_system; protected $_skin_name = 'testing'; diff --git a/tests/library/Class/Profil/SkinUpdateReaderTest.php b/tests/library/Class/Profil/SkinUpdateReaderTest.php index e9c2085dbda..2d9cd1fa7bc 100644 --- a/tests/library/Class/Profil/SkinUpdateReaderTest.php +++ b/tests/library/Class/Profil/SkinUpdateReaderTest.php @@ -20,7 +20,7 @@ */ -class Class_SkinUpdateReaderTest extends Storm_Test_ModelTestCase { +class Class_SkinUpdateReaderTest extends ModelTestCase { protected $_reader; public function setUp() { diff --git a/tests/library/Class/RemoteClientTest.php b/tests/library/Class/RemoteClientTest.php index 601285b97df..d7b1f1be2d1 100644 --- a/tests/library/Class/RemoteClientTest.php +++ b/tests/library/Class/RemoteClientTest.php @@ -19,7 +19,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -class RemoteClientIpAddressTest extends Storm_Test_ModelTestCase { +class RemoteClientIpAddressTest extends ModelTestCase { public function setUp() { parent::setUp(); $this->_SERVER_BAK = $_SERVER; diff --git a/tests/library/Class/ScriptLoaderTest.php b/tests/library/Class/ScriptLoaderTest.php index 8683dc97a21..53e90213d7e 100644 --- a/tests/library/Class/ScriptLoaderTest.php +++ b/tests/library/Class/ScriptLoaderTest.php @@ -240,7 +240,7 @@ class ScriptLoaderVersionHashTest extends PHPUnit_Framework_TestCase { -class ScriptLoaderNotificationsBarTest extends Storm_Test_ModelTestCase { +class ScriptLoaderNotificationsBarTest extends ModelTestCase { public function setUp() { Class_ScriptLoader::resetInstance(); $messenger = new ZendAfi_Controller_Action_Helper_FlashMessenger(); diff --git a/tests/library/Class/SitothequeTest.php b/tests/library/Class/SitothequeTest.php index e7b008a40ac..686b80aa3cf 100644 --- a/tests/library/Class/SitothequeTest.php +++ b/tests/library/Class/SitothequeTest.php @@ -18,7 +18,7 @@ * along with BOKEH; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -class SitothequeSitesFromIdsAndCategoriesTest extends Storm_Test_ModelTestCase { +class SitothequeSitesFromIdsAndCategoriesTest extends ModelTestCase { /** @test */ function getSitesFromIdAndCategoriesShouldReturnFeeds() { $site_premiere = Class_Sitotheque::getLoader()->newInstanceWithId(26); diff --git a/tests/library/Class/StatsNoticesTest.php b/tests/library/Class/StatsNoticesTest.php index eff40751cb9..53511809226 100644 --- a/tests/library/Class/StatsNoticesTest.php +++ b/tests/library/Class/StatsNoticesTest.php @@ -19,7 +19,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -class Class_StatsNoticesTest extends Storm_Test_ModelTestCase { +class Class_StatsNoticesTest extends ModelTestCase { protected $_model; protected $_registry_sql; protected $_sql; diff --git a/tests/library/Class/SuggestionAchatTest.php b/tests/library/Class/SuggestionAchatTest.php index c9b5d4a9a21..546515c74da 100644 --- a/tests/library/Class/SuggestionAchatTest.php +++ b/tests/library/Class/SuggestionAchatTest.php @@ -20,7 +20,7 @@ */ -abstract class SuggestionAchatTestCase extends Storm_Test_ModelTestCase { +abstract class SuggestionAchatTestCase extends ModelTestCase { protected $_mock_transport; protected $_suggestion; diff --git a/tests/library/Class/Systeme/ModulesMenu/NumilogTest.php b/tests/library/Class/Systeme/ModulesMenu/NumilogTest.php index 1d89e0e1a26..99b397cb88f 100644 --- a/tests/library/Class/Systeme/ModulesMenu/NumilogTest.php +++ b/tests/library/Class/Systeme/ModulesMenu/NumilogTest.php @@ -20,7 +20,7 @@ */ -class Class_Systeme_ModulesMenu_NumilogTest extends Storm_Test_ModelTestCase { +class Class_Systeme_ModulesMenu_NumilogTest extends ModelTestCase { public function setUp() { parent::setUp(); RessourcesNumeriquesFixtures::activate(); diff --git a/tests/library/Class/Systeme/ModulesMenu/VodeclicTest.php b/tests/library/Class/Systeme/ModulesMenu/VodeclicTest.php index 3dccd2fdb48..4215da2cfd3 100644 --- a/tests/library/Class/Systeme/ModulesMenu/VodeclicTest.php +++ b/tests/library/Class/Systeme/ModulesMenu/VodeclicTest.php @@ -20,7 +20,7 @@ */ -class Class_Systeme_ModulesMenu_VodeclicTest extends Storm_Test_ModelTestCase { +class Class_Systeme_ModulesMenu_VodeclicTest extends ModelTestCase { public function setUp() { parent::setUp(); RessourcesNumeriquesFixtures::activate(); diff --git a/tests/library/Class/Systeme/ModulesMenuTest.php b/tests/library/Class/Systeme/ModulesMenuTest.php index 524278f1472..878f52b6bdd 100644 --- a/tests/library/Class/Systeme/ModulesMenuTest.php +++ b/tests/library/Class/Systeme/ModulesMenuTest.php @@ -21,7 +21,7 @@ include_once('tests/fixtures/RessourcesNumeriquesFixtures.php'); -abstract class ModulesMenuBibNumeriqueTestCase extends Storm_Test_ModelTestCase { +abstract class ModulesMenuBibNumeriqueTestCase extends ModelTestCase { public function availableServices() { return [ ['VODECLIC', 'Vodeclic'], @@ -111,7 +111,7 @@ class ModulesMenuBibNumeriqueDeactivatedComboTest extends ModulesMenuBibNumeriqu -class ModulesMenuTest extends Storm_Test_ModelTestCase { +class ModulesMenuTest extends ModelTestCase { public function setUp() { parent::setUp(); Zend_Controller_Front::getInstance() diff --git a/tests/library/Class/Systeme/PergameServiceTest.php b/tests/library/Class/Systeme/PergameServiceTest.php index 37d957a4cdf..fcb174660a7 100644 --- a/tests/library/Class/Systeme/PergameServiceTest.php +++ b/tests/library/Class/Systeme/PergameServiceTest.php @@ -149,7 +149,7 @@ class PergameServiceRegleReservationTest extends PergameServiceTestCase { -class PergameServiceReserverExemplaireValidationsTest extends Storm_Test_ModelTestCase { +class PergameServiceReserverExemplaireValidationsTest extends ModelTestCase { public function userValidationDatas() { return [ [null, 'Vous devez être connecté'], @@ -191,10 +191,11 @@ class PergameServiceReserverExemplaireValidationsTest extends Storm_Test_ModelTe } -abstract class PergameServiceReserverExemplaireValidUserTestCase extends Storm_Test_ModelTestCase { + + +abstract class PergameServiceReserverExemplaireValidUserTestCase extends ModelTestCase { public function setUp() { parent::setUp(); - Class_Reservation::beVolatile(); Class_Reservation::setTimeSource(new TimeSourceForTest('2015-20-05 12:30:00')); $this->user = $this->fixture('Class_Users', [ @@ -205,15 +206,19 @@ abstract class PergameServiceReserverExemplaireValidUserTestCase extends Storm_T 'ordreabon' => 0 ]); - $this->fixture('Class_TypeDoc', [ - 'id' => 6, - 'label' => 'Bluray', - 'codif_type_doc' => $this->fixture('Class_CodifTypeDoc', [ - 'id' => 6, - 'type_doc_id' => 6, - 'famille_id' => 4 - ]) - ]); + $this->fixture('Class_CosmoVar', + ['id' => 'types_docs', + 'array_as_list' => ['0' => 'non identifié', + '1' => 'Livres', + '2' => 'Revues et journaux', + '3' => 'Musique', + '6' => 'Bluray']]); + + $this->fixture('Class_CodifTypeDoc', [ + 'id' => 6, + 'type_doc_id' => 6, + 'famille_id' => 4 + ]); $this->item = $this->fixture('Class_Exemplaire', [ 'id' => 12, @@ -225,8 +230,6 @@ abstract class PergameServiceReserverExemplaireValidUserTestCase extends Storm_T ]) ]); - Class_Transaction::beVolatile(); - $this->time_source = new PergameServiceTestingTimeSource(); Class_Systeme_PergameService::setTimeSource($this->time_source); diff --git a/tests/library/Class/UserGroupCategorieTest.php b/tests/library/Class/UserGroupCategorieTest.php index 0b45b593e1b..4bfb484a6b4 100644 --- a/tests/library/Class/UserGroupCategorieTest.php +++ b/tests/library/Class/UserGroupCategorieTest.php @@ -16,10 +16,10 @@ * * 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 UserGroupCategorieWithNoGroupTest extends Storm_Test_ModelTestCase { +class UserGroupCategorieWithNoGroupTest extends ModelTestCase { protected $_association; protected $_etablissement; @@ -54,7 +54,7 @@ class UserGroupCategorieWithNoGroupTest extends Storm_Test_ModelTestCase { $this->assertEquals($this->_association->getParentCategorie(), $this->_etablissement); } - + /** @test **/ public function etablissementShouldHaveSousCategorieAssociation() { $this->assertEquals([$this->_association], $this->_etablissement->getSousCategories()); diff --git a/tests/library/Class/UserGroupTest.php b/tests/library/Class/UserGroupTest.php index 63a8ba87621..4f9ca0f3b92 100644 --- a/tests/library/Class/UserGroupTest.php +++ b/tests/library/Class/UserGroupTest.php @@ -18,7 +18,7 @@ * along with BOKEH; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -abstract class UserGroupsTestCase extends Storm_Test_ModelTestCase { +abstract class UserGroupsTestCase extends ModelTestCase { public function setUp() { parent::setUp(); diff --git a/tests/library/Class/UsersTest.php b/tests/library/Class/UsersTest.php index cf88fb197a4..0e8c278a669 100644 --- a/tests/library/Class/UsersTest.php +++ b/tests/library/Class/UsersTest.php @@ -19,284 +19,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -class UserFixtures { - public static function miles() { - return array('ID_USER' => 1, - 'LOGIN' => 'mdavis', - 'ROLE' => 'abonne_sigb', - 'ROLE_LEVEL' => 2, - 'PASSWORD' => 'nifniff', - 'ID_SITE' => 1, - 'NOM' => 'Davis', - 'PRENOM' => 'Miles', - 'DATE_FIN' => '2025-04-26'); - } - - public static function truffaz() { - return array('ID_USER' => 34, - 'LOGIN' => 'etruffaz', - 'ROLE' => 'invite', - 'ROLE_LEVEL' => 0, - 'PASSWORD' => 'nafnaf', - 'ID_SITE' => 1, - 'NOM' => 'Truffaz', - 'PRENOM' => 'Erik', - 'DATE_FIN' => '2001-10-23'); - } - - public static function all() { - return array(self::miles(), - self::truffaz()); - } -} - - - -class UsersTestLoader extends PHPUnit_Framework_TestCase { - - public function testIdFieldIsID_USER() { - $loader = Class_Users::getLoader(); - $this->assertEquals('id_user', $loader->getIdField()); - } -} - - - -class UsersMilesDavisAttributesTest extends PHPUnit_Framework_TestCase { - public function setUp() { - parent::setUp(); - $this->miles = Class_Users::getLoader()->newFromRow(UserFixtures::miles()); - } - - public function testID_USER() { - $this->assertEquals(1, $this->miles->ID_USER); - } - - public function testNOM() { - $this->assertEquals('Davis', $this->miles->NOM); - } - - public function testPRENOM() { - $this->assertEquals('Miles', $this->miles->PRENOM); - } - - - /** @test */ - public function idSigbShouldDefaultToEmpty() { - $this->assertEquals('', $this->miles->getIdSigb()); - } - - public function testSetPRENOM() { - $this->miles->PRENOM = 'Miles Dewey'; - $this->assertEquals('Miles Dewey', $this->miles->PRENOM); - $this->assertEquals('Miles Dewey', $this->miles->getPrenom()); - } - - public function testSetNOM() { - $this->miles->NOM = 'DAVIS'; - $this->assertEquals('DAVIS', $this->miles->NOM); - $this->assertEquals('DAVIS', $this->miles->getNom()); - } - - public function testSetID() { - $this->miles->ID = 25; - $this->assertEquals(25, $this->miles->ID_USER); - $this->assertEquals(25, $this->miles->getId()); - } - - public function testGetUnknownFieldReturnsNull() { - $this->assertEquals(null, $this->miles->INEXISTANT); - } - - public function testSetUnknownFieldCreatesIt() { - $this->miles->INEXISTANT = 12; - $this->assertEquals(12, $this->miles->INEXISTANT); - $this->assertEquals(12, $this->miles->getInexistant()); - } - - /** @test */ - function abonnementShouldBeValid() { - $this->assertTrue($this->miles->isAbonnementValid()); - } - -} - - - - -class UsersErikTruffazAttributesTest extends PHPUnit_Framework_TestCase { - public function setUp() { - parent::setUp(); - $this->truffaz = Class_Users::getLoader()->newFromRow(UserFixtures::truffaz()); - } - - - /** @test */ - function abonnementShouldNotBeValid() { - $this->assertFalse($this->truffaz->isAbonnementValid()); - } -} - - - - -class UsersFindAllTest extends ModelTestCase { - public function setUp() { - parent::setUp(); - $this->_setFindAllExpectation('Class_Users', UserFixtures::all()); - $this->users = Class_Users::getLoader()->findAll(); - } - - public function testFirstIsDavis() { - $davis = $this->users[0]; - $this->assertEquals(1, $davis->getId()); - $this->assertEquals('Davis', $davis->getNom()); - $this->assertEquals('Miles', $davis->getPrenom()); - } - - public function testSecondIsTruffaz() { - $truffaz = $this->users[1]; - $this->assertEquals(34, $truffaz->getId()); - $this->assertEquals('Truffaz', $truffaz->getNom()); - $this->assertEquals('Erik', $truffaz->getPrenom()); - } -} - - - - -class UsersFindByIdTest extends ModelTestCase { - public function testFindByIdOneReturnsMiles() { - $this->_setFindExpectation('Class_Users', UserFixtures::miles(), 1); - $miles = Class_Users::getLoader()->find(1); - $this->assertEquals(1, $miles->getId()); - $this->assertEquals('Davis', $miles->getNom()); - } - - public function testFindByIdThirtyFourReturnsTruffaz() { - $this->_setFindExpectation('Class_Users', UserFixtures::truffaz(), 34); - $truffaz = Class_Users::getLoader()->find(34); - $this->assertEquals(34, $truffaz->getId()); - $this->assertEquals('Truffaz', $truffaz->getNom()); - } - -} - - - - -class UsersSaveTest extends ModelTestCase { - - protected $_storm_default_to_volatile = true; - - - /** @test */ - public function saveNewUser() { - $new_user = Class_Users::newInstance(['nom' => 'Coltrane', - 'prenom' => 'John', - 'login' => 'jcoltrane', - 'password' => 'giantsteps', - 'role_level' => 2, - 'id_site' => 1, - 'role' => 'abonne_sigb', - 'idabon' => '1234', - 'date_fin' => '', - 'naissance' => '', - 'date_debut' => '', - 'telephone' => '', - 'mail' => '', - 'adresse' => '', - 'code_postal' => '', - 'ville' => '', - 'id_sigb' => null, - 'is_contact_sms' => 0, - 'is_contact_mail' => 0, - 'date_maj' => '2013-10-23 11:47:38', - 'mobile' => '', - 'civilite' => 0, - 'ordreabon' => '', - 'id_panier_courant' => 0, - 'pseudo' => '', - 'settings' => '', - 'statut' => 0]); - - $new_user->save(); - $this->assertEquals(1, $new_user->getId()); - $this->assertEquals(1234, $new_user->getIdabon()); - } - - - /** @test */ - public function saveExistingUser() { - $user = $this->fixture('Class_Users', - ['id' => 189, - 'nom' => 'Truffaz', - 'prenom' => 'Erik', - 'login' => 'etruffaz', - 'role' => 'invite', - 'role_level' => 0, - 'password' => 'nafnaf', - 'id_site' => 1, - 'mail' => 'erik@truffaz.com', - 'id_user' => 34, - 'date_fin' => '2001-10-23', - 'idabon' => '', - 'naissance' => '', - 'date_debut' => '', - 'telephone' => '', - 'adresse' => '', - 'code_postal' => '', - 'ville' => '', - 'id_sigb' => null, - 'is_contact_sms' => 0, - 'is_contact_mail' => 0, - 'date_maj' => '2013-10-23 11:47:38', - 'mobile' => '', - 'civilite' => 0, - 'ordreabon' => '', - 'id_panier_courant' => 0, - 'pseudo' => '', - 'settings' => '', - 'statut' => 0]); - - $user->setMail('erik@truffaz.com')->save(); - $this->assertEquals('erik@truffaz.com', Class_Users::find(189)->getMail()); - } -} - - - - -class UsersDeleteTest extends ModelTestCase { - protected $_storm_default_to_volatile = true; - - - - /** @test */ - public function deleteMilesShouldDeleteId1() { - $miles = $this->fixture('Class_Users', - array_merge(['id' => 1, - 'idabon' => 789], - UserFixtures::miles())); - Class_Users::find(1)->delete(); - $this->assertNull(Class_Users::find(1)); - } - - - /** @test */ - public function deleteTruffazShouldDeleteWithId34() { - $truffaz = $this->fixture('Class_Users', - array_merge(['id' => 34, - 'idabon' => 734], - UserFixtures::truffaz())); - Class_Users::find(34)->delete(); - $this->assertNull(Class_Users::find(34)); - } -} - - - - class UsersTestAssociations extends ModelTestCase { protected $_storm_default_to_volatile = true; @@ -476,7 +198,7 @@ class UsersAgeTest extends ModelTestCase { -abstract class UsersMailingActionTestCase extends Storm_Test_ModelTestCase { +abstract class UsersMailingActionTestCase extends ModelTestCase { protected $mock_transport, $user; public function setUp() { @@ -766,7 +488,7 @@ class UsersFicheAbonneTest extends ModelTestCase { -class UsersGetIdentityWithSessionErrorTest extends Storm_Test_ModelTestCase { +class UsersGetIdentityWithSessionErrorTest extends ModelTestCase { /** @test */ public function getIdentityShouldReturnNullOnZendSessionException() { ZendAfi_Auth::setInstance(Storm_Test_ObjectWrapper::mock() @@ -865,6 +587,11 @@ class UsersWithLoginThroughSigbOnlyTest extends ModelTestCase { protected $_storm_default_to_volatile = true; + public function setUp() { + parent::setUp(); + Class_Crypt::setPhpCommand(null); + } + /** @test */ public function borrowerPasswordShouldBeEmpty() { diff --git a/tests/library/Class/VodeclicLinkTest.php b/tests/library/Class/VodeclicLinkTest.php index 1bf5fbe4099..3552818b508 100644 --- a/tests/library/Class/VodeclicLinkTest.php +++ b/tests/library/Class/VodeclicLinkTest.php @@ -16,10 +16,10 @@ * * 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 */ -abstract class VodeclicLinkTestCase extends Storm_Test_ModelTestCase { +abstract class VodeclicLinkTestCase extends ModelTestCase { public function setUp() { parent::setUp(); Class_AdminVar::newInstanceWithId('VODECLIC_KEY', ['valeur' => '2m5js1dPpFNrtAJbsfX1']); @@ -51,7 +51,7 @@ class VodeclicLinkWithAbonTest extends VodeclicLinkTestCase { /** @test */ public function urlForJeanShouldBeBiblioSSO() { - $this->assertEquals('https://biblio.vodeclic.com/auth/biblio/sso', + $this->assertEquals('https://biblio.vodeclic.com/auth/biblio/sso', $this->_vodeclic->baseUrl()); } @@ -67,7 +67,7 @@ class VodeclicLinkWithAbonTest extends VodeclicLinkTestCase { 'prenom=Jean&'. 'bib_id=543', $this->encrypted_id, - $this->encrypted_date), + $this->encrypted_date), $this->_vodeclic->url()); } @@ -82,7 +82,7 @@ class VodeclicLinkWithAbonTest extends VodeclicLinkTestCase { 'partenaire=bonlieu&'. 'bib_id=543', $this->encrypted_id, - $this->encrypted_date), + $this->encrypted_date), $this->_vodeclic->url()); } } diff --git a/tests/library/Class/WebService/Album/VignetteTest.php b/tests/library/Class/WebService/Album/VignetteTest.php index 648f3a3511b..ce93a68cda6 100644 --- a/tests/library/Class/WebService/Album/VignetteTest.php +++ b/tests/library/Class/WebService/Album/VignetteTest.php @@ -16,10 +16,10 @@ * * 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 */ -abstract class Class_WebService_Album_VignetteTestCase extends Storm_Test_ModelTestCase { +abstract class Class_WebService_Album_VignetteTestCase extends ModelTestCase { protected $_vignette, $_http_client; public function setUp() { @@ -68,8 +68,8 @@ abstract class Class_WebService_Album_VignetteBlancheNeigeTestCase extends Class Class_Album::newInstanceWithId(45) ->setTitre('Blanche Neige') ->beArteVOD() - ->setNotes([['field' => '856', - 'data' => ['x' => 'poster', + ->setNotes([['field' => '856', + 'data' => ['x' => 'poster', 'a' => 'http://mediatheque.com/blanche_neige.jpg']]])); @@ -155,7 +155,7 @@ class Class_WebService_Album_VignetteBlancheNeigeTest extends Class_WebService_A /** @test */ public function albumUploadMoverShouldBeAnInstanceOfClass_UploadMover_LocalFile() { - $this->assertInstanceOf('Class_UploadMover_LocalFile', + $this->assertInstanceOf('Class_UploadMover_LocalFile', $this->_album->getUploadHandler('fichier')->getUploadMover()); } } @@ -167,8 +167,8 @@ class Class_WebService_Album_VignetteBlancheNeigeErrorsTest extends Class_WebSer /** @test */ public function withoutValidUrlShouldNotDownloadImage() { $this->_album - ->setNotes([['field' => '856', - 'data' => ['x' => 'poster', + ->setNotes([['field' => '856', + 'data' => ['x' => 'poster', 'a' => 'zork']]]); $this->_vignette->updateAlbum($this->_album); $this->assertFalse($this->_http_client->methodHasBeenCalled('open_url')); diff --git a/tests/library/Class/WebService/CyberlibrisTest.php b/tests/library/Class/WebService/CyberlibrisTest.php index 59d60fce4b7..8cc7d282fd6 100644 --- a/tests/library/Class/WebService/CyberlibrisTest.php +++ b/tests/library/Class/WebService/CyberlibrisTest.php @@ -100,7 +100,7 @@ class CyberlibrisHarvestSaveTest extends ModelTestCase { -class CyberlibrisIncTest extends Storm_Test_ModelTestCase { +class CyberlibrisIncTest extends ModelTestCase { public function tearDown() { Storm_Model_Loader::defaultToDb(); parent::tearDown(); diff --git a/tests/library/Class/WebService/MappedSoapClientTest.php b/tests/library/Class/WebService/MappedSoapClientTest.php index dfc4793b9e5..23a57fc0115 100644 --- a/tests/library/Class/WebService/MappedSoapClientTest.php +++ b/tests/library/Class/WebService/MappedSoapClientTest.php @@ -20,7 +20,7 @@ */ -abstract class MappedSoapClientTestCase extends Storm_Test_ModelTestCase { +abstract class MappedSoapClientTestCase extends ModelTestCase { protected $_soap_client; public function setUp() { diff --git a/tests/library/Class/WebService/NumeriquePremiumTest.php b/tests/library/Class/WebService/NumeriquePremiumTest.php index 2ba2390dd76..0b9d45f6cae 100644 --- a/tests/library/Class/WebService/NumeriquePremiumTest.php +++ b/tests/library/Class/WebService/NumeriquePremiumTest.php @@ -20,7 +20,7 @@ */ -class Class_WebService_NumeriquePremiumHarvestTest extends Storm_Test_ModelTestCase { +class Class_WebService_NumeriquePremiumHarvestTest extends ModelTestCase { public function setUp() { parent::setUp(); diff --git a/tests/library/Class/WebService/Orphea/CatalogueParserTest.php b/tests/library/Class/WebService/Orphea/CatalogueParserTest.php index f4b2b0fa98c..1e7221f8e76 100644 --- a/tests/library/Class/WebService/Orphea/CatalogueParserTest.php +++ b/tests/library/Class/WebService/Orphea/CatalogueParserTest.php @@ -21,7 +21,7 @@ include_once('tests/fixtures/HarvestOrpheaFixtures.php'); -class CatalogueParserOrpheaTest extends Storm_Test_ModelTestCase { +class CatalogueParserOrpheaTest extends ModelTestCase { public function setUp() { parent::setUp(); $this->_parser = new Class_WebService_BibNumerique_Orphea_CatalogueParser(); @@ -36,7 +36,7 @@ class CatalogueParserOrpheaTest extends Storm_Test_ModelTestCase { -class CatalogueParserMetaDatasTest extends Storm_Test_ModelTestCase { +class CatalogueParserMetaDatasTest extends ModelTestCase { public function tearDown() { Storm_Model_Loader::defaultToDb(); parent::tearDown(); @@ -59,7 +59,7 @@ class CatalogueParserMetaDatasTest extends Storm_Test_ModelTestCase { -class CatalogueParserAssetsUrlTest extends Storm_Test_ModelTestCase { +class CatalogueParserAssetsUrlTest extends ModelTestCase { public function tearDown() { Storm_Model_Loader::defaultToDb(); parent::tearDown(); diff --git a/tests/library/Class/WebService/SIGB/BiblixNetTest.php b/tests/library/Class/WebService/SIGB/BiblixNetTest.php index cfa2e491153..4a043dd5a48 100644 --- a/tests/library/Class/WebService/SIGB/BiblixNetTest.php +++ b/tests/library/Class/WebService/SIGB/BiblixNetTest.php @@ -21,7 +21,7 @@ require_once('BiblixNetFixtures.php'); -class BiblixNetGetServiceTest extends Storm_Test_ModelTestCase { +class BiblixNetGetServiceTest extends ModelTestCase { public function setUp() { parent::setUp(); Class_WebService_SIGB_BiblixNet::reset(); @@ -46,7 +46,7 @@ class BiblixNetGetServiceTest extends Storm_Test_ModelTestCase { -abstract class BiblixNetTestCase extends Storm_Test_ModelTestCase { +abstract class BiblixNetTestCase extends ModelTestCase { /** @var PHPUnit_Framework_MockObject_MockObject */ protected $_mock_web_client; diff --git a/tests/library/Class/WebService/SIGB/CarthameTest.php b/tests/library/Class/WebService/SIGB/CarthameTest.php index 91100a3aa05..9b4ad4c5091 100644 --- a/tests/library/Class/WebService/SIGB/CarthameTest.php +++ b/tests/library/Class/WebService/SIGB/CarthameTest.php @@ -19,7 +19,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -abstract class CarthameTestCase extends Storm_Test_ModelTestCase { +abstract class CarthameTestCase extends ModelTestCase { protected $mock_web_client; protected $service; diff --git a/tests/library/Class/WebService/SIGB/CdScriptTest.php b/tests/library/Class/WebService/SIGB/CdScriptTest.php index 3b52b876b94..ba940d8ecda 100644 --- a/tests/library/Class/WebService/SIGB/CdScriptTest.php +++ b/tests/library/Class/WebService/SIGB/CdScriptTest.php @@ -20,7 +20,7 @@ */ -abstract class CdScriptTestCase extends Storm_Test_ModelTestCase { +abstract class CdScriptTestCase extends ModelTestCase { protected $_service; public function setUp() { diff --git a/tests/library/Class/WebService/SIGB/EmpruntTest.php b/tests/library/Class/WebService/SIGB/EmpruntTest.php index 3365a58f08b..58c1e1153f1 100644 --- a/tests/library/Class/WebService/SIGB/EmpruntTest.php +++ b/tests/library/Class/WebService/SIGB/EmpruntTest.php @@ -19,7 +19,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -class WebServiceSIGBEmpruntTest extends Storm_Test_ModelTestCase { +class WebServiceSIGBEmpruntTest extends ModelTestCase { /** @test */ public function empruntShouldNotBeRetardWithDateRetourToday() { $emprunt = Class_WebService_SIGB_Emprunt::newInstanceWithEmptyExemplaire() diff --git a/tests/library/Class/WebService/SIGB/ExemplaireTest.php b/tests/library/Class/WebService/SIGB/ExemplaireTest.php index f07bacabb15..5124a52a1cb 100644 --- a/tests/library/Class/WebService/SIGB/ExemplaireTest.php +++ b/tests/library/Class/WebService/SIGB/ExemplaireTest.php @@ -19,7 +19,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -class ExemplaireSIGBTest extends Storm_Test_ModelTestCase { +class ExemplaireSIGBTest extends ModelTestCase { public function setUp() { parent::setUp(); Class_Profil::setCurrentProfil($this->fixture('Class_Profil', @@ -53,7 +53,7 @@ class ExemplaireSIGBTest extends Storm_Test_ModelTestCase { -class ExemplaireWithMultipleItemsTest extends Storm_Test_ModelTestCase { +class ExemplaireWithMultipleItemsTest extends ModelTestCase { protected $_storm_default_to_volatile = true; @@ -107,7 +107,7 @@ class ExemplaireWithMultipleItemsTest extends Storm_Test_ModelTestCase { -class ExemplaireWithMultipleItemsAndSameIdOrigineTest extends Storm_Test_ModelTestCase { +class ExemplaireWithMultipleItemsAndSameIdOrigineTest extends ModelTestCase { protected $_storm_default_to_volatile = true; public function setUp() { diff --git a/tests/library/Class/WebService/SIGB/MicrobibServiceTest.php b/tests/library/Class/WebService/SIGB/MicrobibServiceTest.php index 8c5ef82bf7c..b04fb8d0ac1 100644 --- a/tests/library/Class/WebService/SIGB/MicrobibServiceTest.php +++ b/tests/library/Class/WebService/SIGB/MicrobibServiceTest.php @@ -20,7 +20,7 @@ */ include_once('MicrobibFixtures.php'); -abstract class MicrobibServiceTestCase extends Storm_Test_ModelTestCase { +abstract class MicrobibServiceTestCase extends ModelTestCase { protected $_storm_default_to_volatile = true; protected $_search_client; protected $_microbib; diff --git a/tests/library/Class/WebService/SIGB/PMBTest.php b/tests/library/Class/WebService/SIGB/PMBTest.php index c428791932c..9e3b1c2e278 100644 --- a/tests/library/Class/WebService/SIGB/PMBTest.php +++ b/tests/library/Class/WebService/SIGB/PMBTest.php @@ -20,7 +20,7 @@ */ require_once 'tests/fixtures/PmbFixtures.php'; -abstract class PMBTestCase extends Storm_Test_ModelTestCase { +abstract class PMBTestCase extends ModelTestCase { protected $_service; public function setUp() { diff --git a/tests/library/Class/WebService/SIGB/VSmartTest.php b/tests/library/Class/WebService/SIGB/VSmartTest.php index 07a848b755e..06c47765841 100644 --- a/tests/library/Class/WebService/SIGB/VSmartTest.php +++ b/tests/library/Class/WebService/SIGB/VSmartTest.php @@ -20,7 +20,7 @@ */ include_once('VSmartFixtures.php'); -abstract class VSmartServiceTestCase extends Storm_Test_ModelTestCase { +abstract class VSmartServiceTestCase extends ModelTestCase { public function setUp() { $this->fixture('Class_CodifAnnexe', ['id'=> 1, @@ -35,7 +35,7 @@ abstract class VSmartServiceTestCase extends Storm_Test_ModelTestCase { } -class VSmartServiceDummyFunctionsTest extends Storm_Test_ModelTestCase { +class VSmartServiceDummyFunctionsTest extends ModelTestCase { public function setUp() { $this->service = Class_WebService_SIGB_VSmart_Service::newInstance(); } @@ -60,7 +60,7 @@ class VSmartServiceDummyFunctionsTest extends Storm_Test_ModelTestCase { -class VSmartGetServiceTest extends Storm_Test_ModelTestCase { +class VSmartGetServiceTest extends ModelTestCase { public function setUp() { Class_WebService_SIGB_VSmart::reset(); $this->service = Class_WebService_SIGB_VSmart::getService(['url_serveur' => 'vpn.moulins.fr']); @@ -419,7 +419,7 @@ class VSmartServiceWithEmprunteurFranckTest extends VSmartServiceTestCase { -class VSmartServiceBibGetAnthologieLitteratureTest extends Storm_Test_ModelTestCase { +class VSmartServiceBibGetAnthologieLitteratureTest extends ModelTestCase { public function setUp() { $mock_web_client = $this->mock() ->whenCalled('open_url') @@ -462,7 +462,7 @@ class VSmartServiceBibGetAnthologieLitteratureTest extends Storm_Test_ModelTestC -class VSmartServiceBibGetConsultationTest extends Storm_Test_ModelTestCase { +class VSmartServiceBibGetConsultationTest extends ModelTestCase { public function setUp() { $mock_web_client = $this->mock() ->whenCalled('open_url') @@ -498,7 +498,7 @@ class VSmartServiceBibGetConsultationTest extends Storm_Test_ModelTestCase { } -class VSmartServiceBibGetHarryPotterTest extends Storm_Test_ModelTestCase { +class VSmartServiceBibGetHarryPotterTest extends ModelTestCase { public function setUp() { $mock_web_client = $this->mock() ->whenCalled('open_url') @@ -659,7 +659,7 @@ class VSmartServiceBibGetHarryPotterTest extends Storm_Test_ModelTestCase { -class VSmartServiceFunctionsTest extends Storm_Test_ModelTestCase { +class VSmartServiceFunctionsTest extends ModelTestCase { public function setUp() { $this->mock_web_client = $this->mock(); $this->service = Class_WebService_SIGB_VSmart_Service::getService('86.64.58.38/formation/'); diff --git a/tests/library/Class/WebService/WebAnalyticsClientTest.php b/tests/library/Class/WebService/WebAnalyticsClientTest.php index ccfb737a6cd..b1cd673a1a7 100644 --- a/tests/library/Class/WebService/WebAnalyticsClientTest.php +++ b/tests/library/Class/WebService/WebAnalyticsClientTest.php @@ -20,7 +20,7 @@ */ -class Class_WebService_WebAnalyticsClientInstanciationWithVarGoogleAnalyticsAndNoDomainNameTest extends Storm_Test_ModelTestCase { +class Class_WebService_WebAnalyticsClientInstanciationWithVarGoogleAnalyticsAndNoDomainNameTest extends ModelTestCase { public function setUp() { parent::setUp(); @@ -59,7 +59,7 @@ class Class_WebService_WebAnalyticsClientInstanciationWithVarGoogleAnalyticsAndN -class Class_WebService_WebAnalyticsClientInstanciationWithVarGoogleAnalyticsUsingGACreateTest extends Storm_Test_ModelTestCase { +class Class_WebService_WebAnalyticsClientInstanciationWithVarGoogleAnalyticsUsingGACreateTest extends ModelTestCase { public function setUp() { parent::setUp(); @@ -80,7 +80,7 @@ class Class_WebService_WebAnalyticsClientInstanciationWithVarGoogleAnalyticsUsin -class Class_WebService_WebAnalyticsClientInstanciationWithVarGoogleAnalyticsAndDomainNameTest extends Storm_Test_ModelTestCase { +class Class_WebService_WebAnalyticsClientInstanciationWithVarGoogleAnalyticsAndDomainNameTest extends ModelTestCase { public function setUp() { parent::setUp(); @@ -118,7 +118,7 @@ class Class_WebService_WebAnalyticsClientInstanciationWithVarGoogleAnalyticsAndD -class Class_WebService_WebAnalyticsClientInstanciationWithWrongGoogleAnalyticsAndDomainNameTest extends Storm_Test_ModelTestCase { +class Class_WebService_WebAnalyticsClientInstanciationWithWrongGoogleAnalyticsAndDomainNameTest extends ModelTestCase { public function setUp() { parent::setUp(); @@ -144,7 +144,7 @@ class Class_WebService_WebAnalyticsClientInstanciationWithWrongGoogleAnalyticsAn -class Class_WebService_WebAnalyticsClientInstanciationWithVarPiwikAndNoDomainNameTest extends Storm_Test_ModelTestCase { +class Class_WebService_WebAnalyticsClientInstanciationWithVarPiwikAndNoDomainNameTest extends ModelTestCase { public function setUp() { parent::setUp(); diff --git a/tests/library/Class/WebkioskLinkTest.php b/tests/library/Class/WebkioskLinkTest.php index 810a8e19e51..29e4af9e8ae 100644 --- a/tests/library/Class/WebkioskLinkTest.php +++ b/tests/library/Class/WebkioskLinkTest.php @@ -16,10 +16,10 @@ * * 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 */ -abstract class WebkioskLinkTestCase extends Storm_Test_ModelTestCase { +abstract class WebkioskLinkTestCase extends ModelTestCase { protected $_cle_pulique, @@ -50,7 +50,7 @@ dVvoKCi6/ItLM3QlJQJAEyvWEfvqKnFH13ID5oe/GVOih7O6VzgecEgd3ZawBVWd dsZ77MnSRzIyzrfJ3LlluaXhJl2qJBITE7X8y5RTKw== -----END RSA PRIVATE KEY-----"; - Class_AdminVar::newInstanceWithId('WEBKIOSK_KEY', + Class_AdminVar::newInstanceWithId('WEBKIOSK_KEY', ['valeur' => $this->_cle_publique]); Class_AdminVar::newInstanceWithId('WEBKIOSK_RESERVATION_URL', @@ -59,20 +59,20 @@ dsZ77MnSRzIyzrfJ3LlluaXhJl2qJBITE7X8y5RTKw== } class OpensslTestingAuth extends Class_Multimedia_Utils_OpensslUtil{ - public function opensslSeal($data, &$sealed_data, &$env_keys, + public function opensslSeal($data, &$sealed_data, &$env_keys, $pub_key_ids){ $sealed_data = json_encode(['login' => 'amadou', 'password' => 'secret', 'date' => date('Ymd')]); $env_keys[]= '123456789'; - + return true; } } class WebkioskLinkWithAbonneTest extends WebkioskLinkTestCase { - protected + protected $_webkiosk_link, $_amadou, $_auth_decrypte, @@ -89,8 +89,8 @@ class WebkioskLinkWithAbonneTest extends WebkioskLinkTestCase { $parts = parse_url($this->_url); parse_str($parts['query'], $elements); $sso = $elements['sso']; - $sso_json_decode =json_decode(base64_decode($sso)); - $this->_auth_decrypte = base64_decode($sso_json_decode->data_encrypted); + $sso_json_decode =json_decode(base64_decode($sso)); + $this->_auth_decrypte = base64_decode($sso_json_decode->data_encrypted); } diff --git a/tests/library/ZendAfi/Auth/TryHarderTest.php b/tests/library/ZendAfi/Auth/TryHarderTest.php index b4dd1decb74..9d0060905fd 100644 --- a/tests/library/ZendAfi/Auth/TryHarderTest.php +++ b/tests/library/ZendAfi/Auth/TryHarderTest.php @@ -29,6 +29,7 @@ class ZendAfi_Auth_TryHarderTest extends ModelTestCase { public function setUp() { parent::setUp(); + Class_Crypt::setPhpCommand(null); $this->fixture('Class_Users', ['id' => 1, diff --git a/tests/library/ZendAfi/AuthTest.php b/tests/library/ZendAfi/AuthTest.php index df18919dd28..0f288b08679 100644 --- a/tests/library/ZendAfi/AuthTest.php +++ b/tests/library/ZendAfi/AuthTest.php @@ -19,7 +19,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -class AuthSessionNamespaceTest extends Storm_Test_ModelTestCase { +class AuthSessionNamespaceTest extends ModelTestCase { public function setUp() { parent::setup(); diff --git a/tests/library/ZendAfi/Form/LoginTest.php b/tests/library/ZendAfi/Form/LoginTest.php index 112f72305f5..a85fad34819 100644 --- a/tests/library/ZendAfi/Form/LoginTest.php +++ b/tests/library/ZendAfi/Form/LoginTest.php @@ -20,7 +20,7 @@ */ -abstract class ZendAfi_Form_LoginTestCase extends Storm_Test_ModelTestCase { +abstract class ZendAfi_Form_LoginTestCase extends ModelTestCase { protected $_form; public function setUp() { -- GitLab