/** * Tests the removeAll method * * @depends testFetchListCount */ public function testRemoveAll() { eZURLWildcard::removeAll(); $this->assertEquals(0, $count = eZURLWildcard::fetchListCount(), $count . " wildcards still exist in the database"); }
$http = eZHTTPTool::instance(); $Offset = $Params['Offset']; if ($Module->hasActionParameter('Offset')) { $Offset = $Module->actionParameter('Offset'); } $tpl = eZTemplate::factory(); $limit = 20; $infoCode = 'no-errors'; // This will be modified if info/warning is given to user. $infoData = array(); // Extra parameters can be added to this array $wildcardSrcText = false; $wildcardDstText = false; $wildcardType = false; if ($Module->isCurrentAction('RemoveAllWildcards')) { eZURLWildcard::removeAll(); eZURLWildcard::expireCache(); $infoCode = "feedback-wildcard-removed-all"; } else { if ($Module->isCurrentAction('RemoveWildcard')) { if ($http->hasPostVariable('WildcardIDList')) { $wildcardIDs = $http->postVariable('WildcardIDList'); eZURLWildcard::removeByIDs($wildcardIDs); eZURLWildcard::expireCache(); $infoCode = "feedback-wildcard-removed"; } } else { if ($Module->isCurrentAction('NewWildcard')) { $wildcardSrcText = trim($Module->actionParameter('WildcardSourceText')); $wildcardDstText = trim($Module->actionParameter('WildcardDestinationText')); $wildcardType = $http->hasPostVariable('WildcardType') && strlen(trim($http->postVariable('WildcardType'))) > 0;
/** * Tests the removeAll method * * Outline: * 1. Create a set of wildcards * 2. Call removeall * 3. Check if all these wildcards were removed * * @depends testStore * @depends testFetchList **/ public function testRemoveAll() { // 1. Create a set of wildcards for ($i = 0; $i < 10; $i++) { self::createWildcard("testRemoveAll/{$i}/*", '/', eZURLWildcard::TYPE_DIRECT); } // 2. Call removeAll eZURLWildcard::removeAll(); // 3. Check if all wildcards are indeed gone $wildcards = eZURLWildcard::fetchList(); $this->assertTrue(count($wildcards) == 0, count($wildcards) . " wildcards still exist in the database"); }