diff --git a/library/Class/User/Loans.php b/library/Class/User/Loans.php index bf9435337e02216457e98343e0e9e64b41eae967..4a67f4060f1bbf0838384840132ae869566f20df 100644 --- a/library/Class/User/Loans.php +++ b/library/Class/User/Loans.php @@ -19,7 +19,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -class Class_User_Loans extends Storm_Model_Collection { +class Class_User_Loans extends Storm_Model_Collection_Abstract { public function selectLates() { return $this->select(function($loan) {return $loan->isLate();}); } diff --git a/library/ZendAfi/View/Helper/Accueil/AbonneAbstract.php b/library/ZendAfi/View/Helper/Accueil/AbonneAbstract.php index 2493c44d0824387d946a85fe29b37eb8fe1b02f1..fd2d7d28aab6ef0f8c171d51d8d7004a43d89151 100644 --- a/library/ZendAfi/View/Helper/Accueil/AbonneAbstract.php +++ b/library/ZendAfi/View/Helper/Accueil/AbonneAbstract.php @@ -53,10 +53,11 @@ abstract class ZendAfi_View_Helper_Accueil_AbonneAbstract extends ZendAfi_View_H public function getContenu() { - return implode('', - array_map( - [$this, 'renderModel'], - $this->getModels())); + return (new Storm_Collection($this->getModels())) + ->injectInto('', + function($html, $model) { + return $html.$this->renderModel($model); + }); } diff --git a/library/storm b/library/storm index fa7d2ff2c3c3def70d67ee8ee7f7c7ec3601fdda..fe48ba907df34cf57659db4f77fceabbc7b933ef 160000 --- a/library/storm +++ b/library/storm @@ -1 +1 @@ -Subproject commit fa7d2ff2c3c3def70d67ee8ee7f7c7ec3601fdda +Subproject commit fe48ba907df34cf57659db4f77fceabbc7b933ef diff --git a/tests/TestSpeedTrap.php b/tests/TestSpeedTrap.php index db39c54f9af3bd07735ec18d297c6f2e71721a9b..3a660c1b7d1be2616b99c88202f173e04d2658f9 100644 --- a/tests/TestSpeedTrap.php +++ b/tests/TestSpeedTrap.php @@ -139,8 +139,15 @@ END; if(1 > ($count = count(self::$_speed_trapped_test))) { print <<<END + _ + /(| + ( : + __\ \ _____ + (____) `| +(____)| | + (____).__| + (___)__.|_____ - :D http://ljdchost.com/zLWnDY0.gif END; return; @@ -148,7 +155,13 @@ END; print <<<END - :( http://ljdchost.com/UlaUCrU.gif + .-"-. .-"-. .-"-. + _/_-.-_\_ _/.-.-.\_ _/.-.-.\_ + / __} {__ \ /|( o o )|\ ( ( o o ) ) + / // " \\\\ \ | // " \\\\ | |/ " \| +/ / \'---'/ \ \ / / \'---'/ \ \ \'/^\'/ +\ \_/`"""`\_/ / \ \_/`"""`\_/ / /`\ /`\ + \ / \ / / /|\ \ END; diff --git a/tests/application/modules/AbstractControllerTestCase.php b/tests/application/modules/AbstractControllerTestCase.php index a145de09b866ea54378672661536fddc75e15fe7..ef9ecc7b987bd12e5f6ddf980ef289b672baedd7 100644 --- a/tests/application/modules/AbstractControllerTestCase.php +++ b/tests/application/modules/AbstractControllerTestCase.php @@ -20,7 +20,8 @@ */ abstract class AbstractControllerTestCase extends Zend_Test_PHPUnit_ControllerTestCase { use Storm_Test_THelpers; - protected $_registry_sql, + protected + $_registry_sql, $_storm_default_to_volatile = false; //permet d'authentifier sur la partie admin avant test diff --git a/tests/application/modules/opac/controllers/AbonneVSmartTest.php b/tests/application/modules/opac/controllers/AbonneVSmartTest.php index 92724a7f6b0781802ba39d5c326202d1d7c3af21..149aa07b8d05d94f1bd05cf15b03243b32c87d22 100644 --- a/tests/application/modules/opac/controllers/AbonneVSmartTest.php +++ b/tests/application/modules/opac/controllers/AbonneVSmartTest.php @@ -22,16 +22,11 @@ require_once 'AbstractControllerTestCase.php'; abstract class AbonneVSmartTestCase extends AbstractControllerTestCase { - + protected + $_storm_default_to_volatile = true; public function setUp() { parent::setUp(); - Class_Users::beVolatile(); - Class_UserGroup::beVolatile(); - Class_UserGroupMembership::beVolatile(); - Class_Notice::beVolatile(); - Class_PanierNotice::beVolatile(); - Class_PanierNoticeCatalogue::beVolatile(); $this->manon = Class_Users::newInstanceWithId(34, ['pseudo' => 'Marcus', 'login' => 'mlaffont', 'password' => '123', @@ -44,13 +39,12 @@ abstract class AbonneVSmartTestCase extends AbstractControllerTestCase { $emprunteur ->expects($this->once()) - ->method('getNbPretsEnRetard') - ->will($this->returnValue(1)); + ->method('getEmprunts') + ->will($this->returnValue([Class_WebService_SIGB_Emprunt::newInstanceWithEmptyExemplaire() + ->setDateRetour('25/12/2022'), - $emprunteur - ->expects($this->once()) - ->method('getNbEmprunts') - ->will($this->returnValue(2)); + Class_WebService_SIGB_Emprunt::newInstanceWithEmptyExemplaire() + ->setDateRetour('25/12/2010')])); $emprunteur ->expects($this->once()) diff --git a/tests/application/modules/opac/controllers/ProfilOptionsControllerTest.php b/tests/application/modules/opac/controllers/ProfilOptionsControllerTest.php index df595d8ec415833790219697f0480fdeee4f9b3d..7de264fa4dd5336fd3d96f424ced37707c4616fb 100644 --- a/tests/application/modules/opac/controllers/ProfilOptionsControllerTest.php +++ b/tests/application/modules/opac/controllers/ProfilOptionsControllerTest.php @@ -23,12 +23,15 @@ require_once 'AbstractControllerTestCase.php'; abstract class ProfilOptionsControllerWithProfilAdulteTestCase extends AbstractControllerTestCase { - protected $admin_var; + protected + $admin_var; public function setUp() { parent::setUp(); + Class_Loan_Pnb::beVolatile(); + $this->fixture('Class_AdminVar',['id'=>'MENU_BOITE', 'valeur' => 1]); Class_Systeme_ModulesMenu::reset(); $this->admin_var=$this->fixture('Class_AdminVar',['id' => 'FORMATIONS', @@ -837,8 +840,6 @@ class ProfilOptionsControllerProfilAdulteAsAdminPostConfigKiosqueStyleReloadTest abstract class ProfilOptionsControllerProfilJeunesseWithPagesJeuxMusiqueTestCase extends ProfilOptionsControllerWithProfilAdulteTestCase { - - protected function _loginHook($account) { $account->ROLE = ""; $account->ROLE_LEVEL = 0; @@ -1033,7 +1034,6 @@ class ProfilOptionsControllerProfilJeunesseAndJeuxTest extends ProfilOptionsCont /** @test **/ public function titleBoitePanierShouldLinkToPanierIndex() { - ZendAfi_Auth::getInstance()->logUser($this->admin); $this->dispatch('/opac'); $this->assertXPath('//div[contains(@class,"panier")]//h1/a[contains(@href,"/panier")]',$this->_response->getBody()); diff --git a/tests/library/ZendAfi/View/Helper/Accueil/PretsTest.php b/tests/library/ZendAfi/View/Helper/Accueil/PretsTest.php index b00789d5cda40089002bd76e6bc418a950227b71..47344cadb7517ed602f704955fae45837ca536ef 100644 --- a/tests/library/ZendAfi/View/Helper/Accueil/PretsTest.php +++ b/tests/library/ZendAfi/View/Helper/Accueil/PretsTest.php @@ -16,12 +16,15 @@ * * You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE * along with BOKEH; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ require_once 'library/ZendAfi/View/Helper/ViewHelperTestCase.php'; -class PretsTestWithConnectedUser extends ViewHelperTestCase { +class PretsTestWithConnectedUser extends ViewHelperTestCase { + protected + $_storm_default_to_volatile = true; + public function setUp() { parent::setUp(); @@ -32,7 +35,7 @@ class PretsTestWithConnectedUser extends ViewHelperTestCase { 'titre' => 'Mes documents']]); $helper->setView(new ZendAfi_Controller_Action_Helper_View()); - + $alice = new Class_WebService_SIGB_Emprunt('13', new Class_WebService_SIGB_Exemplaire(456)); $alice->getExemplaire() @@ -59,14 +62,14 @@ class PretsTestWithConnectedUser extends ViewHelperTestCase { $emprunteur->empruntsAddAll(array( $klein, $alice)); $this->html = $helper->getBoite(); } - + /** @test */ public function h1ShouldContainsMesPrets () { $this->assertXPathContentContains($this->html,'//h1','Mes documents'); } - + /** @test */ public function listShouldDisplayAliceNotice() { $this->assertXPathContentContains($this->html,'//ul//li','Alice'); @@ -110,14 +113,14 @@ class PretsTestWithConnectedUser extends ViewHelperTestCase { public function titleShouldBeLinkedToAbonnePrets () { $this->assertXPath($this->html,'//h1//a[contains(@href,"/abonne/prets")]',$this->html); } - + } -class PretsTestWithNonConnectedUser extends ViewHelperTestCase { +class PretsTestWithNonConnectedUser extends ViewHelperTestCase { public function setUp() { parent::setUp(); @@ -129,7 +132,7 @@ class PretsTestWithNonConnectedUser extends ViewHelperTestCase { $this->helper->setView(new ZendAfi_Controller_Action_Helper_View()); $this->html = $this->helper->getBoite(); } - + /** @test */ public function boitePretsShouldNotBeDisplayed () { diff --git a/tests/library/ZendAfi/View/Helper/ViewHelperTestCase.php b/tests/library/ZendAfi/View/Helper/ViewHelperTestCase.php index a78ce5bbc606fd8db0e38d954ea71d97a3bb1b0d..7696e63744fc1f79f79fab3e7e3739b1ff794fda 100644 --- a/tests/library/ZendAfi/View/Helper/ViewHelperTestCase.php +++ b/tests/library/ZendAfi/View/Helper/ViewHelperTestCase.php @@ -21,6 +21,9 @@ abstract class ViewHelperTestCase extends PHPUnit_Framework_TestCase { use Storm_Test_THelpers; + protected + $_storm_default_to_volatile = false; + public function assertQueryContentContains() { call_user_func_array(array(new Storm_Test_XPath(), __FUNCTION__), func_get_args()); @@ -124,10 +127,16 @@ abstract class ViewHelperTestCase extends PHPUnit_Framework_TestCase { Storm_Cache::setDefaultZendCache(null); Zend_Registry::get('translate')->setLocale('fr'); + + if($this->_storm_default_to_volatile) + Storm_Model_Loader::defaultToVolatile(); } protected function tearDown() { + if($this->_storm_default_to_volatile) + Storm_Model_Loader::defaultToDb(); + Storm_Model_Abstract::unsetLoaders(); (new Storm_Cache)->clean(); $this->logout();