/**
  * Test for the fetchBySourceURL method returning an array
  */
 public function testFetchBySourceURLAsArray()
 {
     $fetchedWildcard = eZURLWildcard::fetchBySourceURL('testPair/0/*', false);
     $this->assertInternalType('array', $fetchedWildcard, "Failed fetching the wildcard object as an array");
     $this->assertSame('testPair/0/*', $fetchedWildcard['source_url']);
     $this->assertSame('/', $fetchedWildcard['destination_url']);
     $this->assertEquals(eZURLWildcard::TYPE_DIRECT, $fetchedWildcard['type']);
 }
         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;
         if (strlen($wildcardSrcText) == 0) {
             $infoCode = "error-no-wildcard-text";
         } else {
             if (strlen($wildcardDstText) == 0) {
                 $infoCode = "error-no-wildcard-destination-text";
             } else {
                 $wildcard = eZURLWildcard::fetchBySourceURL($wildcardSrcText, false);
                 if ($wildcard) {
                     $infoCode = "feedback-wildcard-exists";
                     $infoData['wildcard_src_url'] = $wildcardSrcText;
                     $infoData['wildcard_dst_url'] = $wildcard['destination_url'];
                 } else {
                     $row = array('source_url' => $wildcardSrcText, 'destination_url' => $wildcardDstText, 'type' => $wildcardType ? eZURLWildcard::TYPE_FORWARD : eZURLWildcard::TYPE_DIRECT);
                     $wildcard = new eZURLWildcard($row);
                     $wildcard->store();
                     eZURLWildcard::expireCache();
                     $infoData['wildcard_src_url'] = $wildcardSrcText;
                     $infoData['wildcard_dst_url'] = $wildcardDstText;
                     $wildcardSrcText = false;
                     $wildcardDstText = false;
                     $wildcardType = false;
                     $infoCode = "feedback-wildcard-created";
 /**
  * Test for the fetchBySourceURL method
  *
  * Outline:
  * 1. Create a wildcard
  * 2. Call the method with this wildcard's source url
  * 3. Check if the objects have identical contents
  * 4. Call the method again with asObject = false
  * 5. Check if the returned array has the same contents
  **/
 public function testFetchBySourceURL()
 {
     // 1. Create a wildcard entry
     $createdWildcard = self::createWildcard($sourceURL = 'testFetchBySourceURL/*', $destinationURL = '/', $type = eZURLWildcard::TYPE_DIRECT);
     // 2. Fetch by this source URL
     $fetchedWildcard = eZURLWildcard::fetchBySourceURL($sourceURL);
     // 3. Check if the created wildcard and the fetched one are identical
     $this->assertTrue(is_object($fetchedWildcard), "Failed fetching the wildcard object by source URL");
     $this->assertEquals($sourceURL, $fetchedWildcard->attribute('source_url'));
     $this->assertEquals($destinationURL, $fetchedWildcard->attribute('destination_url'));
     $this->assertEquals($type, $fetchedWildcard->attribute('type'));
     // 4. Call the method again with asObject = false
     $fetchedWildcard = eZURLWildcard::fetchBySourceURL($sourceURL, false);
     // 5. Check if the returned array has the same contents
     $this->assertType('array', $fetchedWildcard, "Failed fetching the wildcard object as an array");
     $this->assertEquals($sourceURL, $fetchedWildcard['source_url']);
     $this->assertEquals($destinationURL, $fetchedWildcard['destination_url']);
     $this->assertEquals($type, $fetchedWildcard['type']);
 }