/** * Tests the cleanup method * * @depends testFetch */ public function testCleanup() { eZURLWildcard::cleanup('testPair/0'); // Test if matching wildcards were removed, and non-matching ones were kept $this->assertNull(eZURLWildcard::fetch($this->wildcardObjects['testPair/0/*']->attribute('id')), "Matching wildcard still exists"); $this->assertTrue(is_object(eZURLWildcard::fetch($this->wildcardObjects['testOdd/1/*']->attribute('id'))), "Non matching wildcard was removed"); }
/** * Tests the cleanup method * * Outline: * 1. Create several wildcards, with various destination_url prefixes * 2. Call cleanup with a prefix that matches most of the previously created wildcards * 3. Check that the matching wildcards were removed and the non matching ones weren't * * @depends testFetch **/ public function testCleanup() { // 1. Create a matching and non-matching wildcard entries $matchingWildcard = self::createWildcard("testCleanup/*", '/', eZURLWildcard::TYPE_DIRECT); $nonMatchingWildcard = self::createWildcard("keepTestCleanup/*", '/', eZURLWildcard::TYPE_DIRECT); // 2. Remove the wildcard prefixed with 'testCleanup' eZURLWildcard::cleanup('testCleanup'); // 3. Test if matching wildcards were removed, and non-matching ones were kept $this->assertNull(eZURLWildcard::fetch($matchingWildcard->attribute('id')), "Matching wildcard still exists"); $this->assertTrue(is_object(eZURLWildcard::fetch($nonMatchingWildcard->attribute('id'))), "Non matching wildcard was removed"); }