public function tearDown()
 {
     ezpINIHelper::restoreINISettings();
     $this->event = null;
     ezpEvent::resetInstance();
     parent::tearDown();
 }
    public function tearDown()
    {
        ezpINIHelper::restoreINISettings();
        eZClusterFileHandler::resetHandler();

        parent::tearDown();
    }
 /**
  * Test for {@link eZSolrBase::sendHTTPRequest()} with a request that will time out
  * An exception must be thrown in that case
  * @link http://issues.ez.no/17862
  * @group issue17862
  * @expectedException ezfSolrException
  */
 public function testSendHTTPRequestException()
 {
     ezpINIHelper::setINISetting('solr.ini', 'SolrBase', 'SearchServerURI', $this->nonReachableSolr);
     $solrBase = new eZSolrBase();
     $postString = $solrBase->buildPostString($this->postParams);
     $solrBase->sendHTTPRequest($solrBase->SearchServerURI . $this->testURI, $postString);
 }
 /**
  * Test for regression #13497:
  * attribute operator throws a PHP fatal error on a node without parent in a displayable language
  *
  * Situation:
  *  - siteaccess with one language (fre-FR) and ShowUntranslatedObjects disabled
  *  - parent content node in another language (eng-GB) with always available disabled
  *  - content node in the siteaccess' language (fre-FR)
  *  - fetch this fre-FR node from anywhere, and call attribute() on it
  *
  * Result:
  *  - Fatal error: Call to a member function attribute() on a non-object in
  *    kernel/classes/ezcontentobjecttreenode.php on line 4225
  *
  * Explanation: the error actually comes from the can_remove_location attribute
  **/
 public function testIssue13497()
 {
     // Create a folder in english only
     $folder = new ezpObject("folder", 2, 14, 1, 'eng-GB');
     $folder->setAlwaysAvailableLanguageID(false);
     $folder->name = "Parent for " . __FUNCTION__;
     $folder->publish();
     $locale = eZLocale::instance('fre-FR');
     $translation = eZContentLanguage::addLanguage($locale->localeCode(), $locale->internationalLanguageName());
     // Create an article in french only, as a subitem of the previously created folder
     $article = new ezpObject("article", $folder->attribute('main_node_id'), 14, 1, 'fre-FR');
     $article->title = "Object for " . __FUNCTION__;
     $article->short_description = "Description of test for " . __FUNCTION__;
     $article->publish();
     $articleNodeID = $article->attribute('main_node_id');
     // INi changes: set language to french only, untranslatedobjects disabled
     ezpINIHelper::setINISetting('site.ini', 'RegionalSettings', 'ContentObjectLocale', 'fre-FR');
     ezpINIHelper::setINISetting('site.ini', 'RegionalSettings', 'SiteLanguageList', array('fre-FR'));
     ezpINIHelper::setINISetting('site.ini', 'RegionalSettings', 'ShowUntranslatedObjects', 'disabled');
     eZContentLanguage::expireCache();
     // This should crash
     eZContentObjectTreeNode::fetch($articleNodeID)->attribute('can_remove_location');
     ezpINIHelper::restoreINISettings();
     // re-expire cache for further tests
     eZContentLanguage::expireCache();
 }
 /**
  * Test for eZSolrBase::getLanguageCore()
  * @dataProvider providerForTestGetLanguageCore
  */
 public function testGetLanguageCore($expected, $languageCode, $iniOverrides)
 {
     ezpINIHelper::setINISettings($iniOverrides);
     $solrBase = new eZSolrMultiCoreBase();
     $this->assertEquals($expected, $solrBase->getLanguageCore($languageCode));
     ezpINIHelper::restoreINISettings();
 }
    /**
     * Test for the sort feature of country list
     */
    public function testFetchTranslatedNamesSort()
    {
        $translatedCountriesList = array(
            'FR' => 'France',
            'GB' => 'Royaume-uni',
            'DE' => 'Allemagne',
            'NO' => 'Norvège' );

        ezpINIHelper::setINISetting( array( 'fre-FR.ini', 'share/locale' ), 'CountryNames', 'Countries', $translatedCountriesList );
        ezpINIHelper::setINISetting( 'site.ini', 'RegionalSettings', 'Locale', 'fre-FR' );

        $countries = eZCountryType::fetchCountryList();
        $this->assertInternalType( 'array', $countries, "eZCountryType::fetchCountryList() didn't return an array" );

        $countryListIsSorted = true;
        foreach( $countries as $country )
        {
            if ( !isset( $previousCountry ) )
            {
                $previousCountry = $country;
                continue;
            }

            if ( strcoll( $previousCountry['Name'], $country['Name'] ) > 0 )
            {
                $countryListIsSorted = false;
                break;
            }
        }

        ezpINIHelper::restoreINISettings();
        $this->assertTrue( $countryListIsSorted, "Country list isn't sorted" );
    }
 /**
  * Test scenario for issue #13492: Links are lost after removing version
  *
  * Test Outline
  * ------------
  * 1. Create a Folder in English containing a link (in the short_description attribute).
  * 2. Translate Folder into Norwegian containing another link (not the same link as above.)
  * 3. Remove Folder version 1. (Version 2 is created when translating).
  *
  * @result: short_description in version 2 will have an empty link.
  * @expected: short_description should contain same link as in version 1.
  * @link http://issues.ez.no/13492
  */
 public function testLinksAcrossTranslations()
 {
     ezpINIHelper::setINISetting('site.ini', 'RegionalSettings', 'ContentObjectLocale', 'eng-GB');
     $xmlDataEng = '<link href="/some-where-random">a link</link>';
     $xmlDataNor = '<link href="/et-tilfeldig-sted">en link</link>';
     // Step 1: Create folder
     $folder = new ezpObject("folder", 2);
     $folder->name = "Folder Eng";
     $folder->short_description = $xmlDataEng;
     $folder->publish();
     $version1Xml = $folder->short_description->attribute('output')->attribute('output_text');
     // Step 2: Translate folder
     $trData = array("name" => "Folder Nor", "short_description" => $xmlDataNor);
     $folder->addTranslation("nor-NO", $trData);
     // addTranslation() publishes too.
     // Step 3: Remove version 1
     $version1 = eZContentObjectVersion::fetchVersion(1, $folder->id);
     $version1->removeThis();
     // Grab current versions data and make sure it's fresh.
     $folder->refresh();
     $version2Xml = $folder->short_description->attribute('output')->attribute('output_text');
     $folder->remove();
     ezpINIHelper::restoreINISettings();
     self::assertEquals($version1Xml, $version2Xml);
 }
 public function tearDown()
 {
     ezpINIHelper::restoreINISettings();
     if (isset($GLOBALS['eZClusterFileHandler_chosen_handler'])) {
         unset($GLOBALS['eZClusterFileHandler_chosen_handler']);
     }
     parent::tearDown();
 }
 public function tearDown()
 {
     ezpINIHelper::restoreINISettings();
     eZClusterFileHandler::resetHandler();
     if ($this->haveToRemoveDFSPath) {
         eZDir::recursiveDelete(self::$DFSPath);
     }
     parent::tearDown();
 }
Beispiel #10
0
 public function tearDown()
 {
     $this->solrSearch->removeObject($this->object->object);
     $this->object->remove();
     $this->object = null;
     $this->solrSearch = null;
     ezpINIHelper::restoreINISettings();
     parent::tearDown();
 }
 /**
  * Restores all the INI settings previously modified using setINISetting
  * and clear list of modifed ini settings
  *
  * @return void
  */
 public static function restoreINISettings()
 {
     // restore each changed value in reverse order to be sure history is correct
     foreach (array_reverse(self::$modifiedINISettings) as $key => $values) {
         list($file, $block, $variable, $value) = $values;
         $ini = eZINI::instance($file);
         $ini->setVariable($block, $variable, $value);
     }
     self::$modifiedINISettings = array();
 }
 /**
  * Tests new filter object instance creation
  *
  */
 public function testGetFilter()
 {
     $mobileDeviceDetectFilter = ezpMobileDeviceDetectFilter::getFilter();
     $this->assertNotNull($mobileDeviceDetectFilter);
     $this->assertInstanceOf('ezpMobileDeviceDetectFilterInterface', $mobileDeviceDetectFilter);
     ezpINIHelper::setINISetting('site.ini', 'SiteAccessSettings', 'MobileDeviceFilterClass', '');
     $mobileDeviceDetectFilter = ezpMobileDeviceDetectFilter::getFilter();
     $this->assertNull($mobileDeviceDetectFilter);
     ezpINIHelper::restoreINISettings();
 }
 /**
  * Unit test for eZContentClass::versionHistoryLimit() with object parameters
  *
  * Replica of testVersionHistoryLimit() but you cannot make calls
  * to the eZ API which relies on a database, as this is not present
  * in the provider methods.
  */
 public function testVersionHistoryLimitWithObjectParameter()
 {
     // different custom limits (article: 13, image: 6) and object as a parameter
     $INISettings = array(array('VersionHistoryClass', array('article' => 13, 'image' => 6)));
     $class = eZContentClass::fetchByIdentifier('image');
     $expectedLimit = 6;
     // change the INI limit settings
     foreach ($INISettings as $settings) {
         list($INIVariable, $INIValue) = $settings;
         ezpINIHelper::setINISetting('content.ini', 'VersionManagement', $INIVariable, $INIValue);
     }
     $limit = eZContentClass::versionHistoryLimit($class);
     self::assertEquals($expectedLimit, $limit);
     ezpINIHelper::restoreINISettings();
 }
Beispiel #14
0
    /**
     * Test for issue #16328: Wrong hash stored in database on hash update in ezUser.php
     */
    public function testPasswordHashSamePasswordToUser()
    {
        // Get the password_hash
        $db = eZDB::instance();
        $rows = $db->arrayQuery( "SELECT * FROM ezuser where login = '******'" );
        if ( count( $rows ) !== 1 )
        {
            $this->fail( "User {$this->username} is not in database.");
        }
        // Not used in this test
        $passwordHashMD5Password = $rows[0]['password_hash'];

        // Above it was only the setup for the test, the real test begins now
        // Set HashType to md5_user (password_hash in the ezuser table is updated again)
        ezpINIHelper::setINISetting( 'site.ini', 'UserSettings', 'HashType', 'md5_user' );

        // Login the user with email instead of username
        $userClass = eZUserLoginHandler::instance( 'standard' );
        $user = $userClass->loginUser( $this->email, $this->password );

        // Verify that the email and password were accepted
        if ( !( $user instanceof eZUser ) )
        {
            $this->fail( "User {$this->email} is not in database.");
        }

        // Get the password_hash
        $db = eZDB::instance();
        $rows = $db->arrayQuery( "SELECT * FROM ezuser where login = '******'" );
        $passwordHashMD5User = $rows[0]['password_hash'];

        // The value that is expected to be saved in the ezuser table after updating the HashType to md5_user
        // (using the username and not the email address, which caused issue #16328)
        $hashMD5Expected = md5( "{$this->username}\n{$this->password}" );

        // Verify that the 2 password hashes saved above are the same
        $this->assertEquals( $hashMD5Expected, $passwordHashMD5User );

        // Verify that the user can still login with username
        $userClass = eZUserLoginHandler::instance( 'standard' );
        $user = $userClass->loginUser( $this->username, $this->password );

        // Verify that the username and password were accepted
        if ( !( $user instanceof eZUser ) )
        {
            $this->fail( "User {$this->username} is not in database.");
        }
    }
 public function testConvertToAlias_Compat()
 {
     // We set the below ini settings to make sure they are not accidentally
     // overriden in somewhere in the test installation.
     ezpINIHelper::setINISetting('site.ini', 'URLTranslator', 'WordSeparator', 'underscore');
     ezpINIHelper::setINISetting('site.ini', 'URLTranslator', 'TransformationGroup', 'urlalias_compat');
     // ---------------------------------------------------------------- //
     // Not safe characters, all of these should be removed.
     $e1 = " &;/:=?[]()+#/{}\$*',^§±@.!_";
     $e1Result = "_1";
     // Safe characters. No char should be removed.
     $e2 = "abcdefghijklmnopqrstuvwxyz0123456789";
     $e2Result = $e2;
     // Random selection of funky characters. All chars should be removed.
     $e3 = "ウңҏѫあギᄍㄇᠢ⻲㆞ญ฿";
     $e3Result = "_1";
     // Make sure uppercase chars gets converted to lowercase.
     $e4 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
     $e4Result = "abcdefghijklmnopqrstuvwxyz";
     // Make sure multiple dots are turned into a seperator (-) (dot is
     // allowed exepct beginning/end of url).
     $e5 = "..a...........b..";
     $e5Result = "a_b";
     self::assertEquals($e1Result, eZURLAliasML::convertToAlias($e1));
     self::assertEquals($e2Result, eZURLAliasML::convertToAlias($e2));
     self::assertEquals($e3Result, eZURLAliasML::convertToAlias($e3));
     self::assertEquals($e4Result, eZURLAliasML::convertToAlias($e4));
     self::assertEquals($e5Result, eZURLAliasML::convertToAlias($e5));
     // ---------------------------------------------------------------- //
     ezpINIHelper::restoreINISettings();
 }
 /**
  * Tests if mobile device detection is enabled but MobileSiteAccessList is not provided
  *
  */
 public function testIsEnabledBadSetting()
 {
     ezpINIHelper::setINISetting('site.ini', 'SiteAccessSettings', 'MobileSiteAccessList', '');
     $this->assertFalse($this->mobileDeviceDetect->isEnabled());
 }
 public function tearDown()
 {
     parent::tearDown();
     ezpINIHelper::restoreINISettings();
     $this->mobileDeviceDetect = null;
 }
Beispiel #18
0
 /**
  * See site.ini [MailSettings] ExcludeHeaders
  */
 public function testExcludeHaders()
 {
     self::markTestSkipped("Tests needs to use other email addresses");
     ezpINIHelper::setINISetting('site.ini', 'MailSettings', 'Transport', 'SMTP');
     ezpINIHelper::setINISetting('site.ini', 'MailSettings', 'ExcludeHeaders', array('bcc'));
     $mail = new eZMail();
     $mail->setReceiver('*****@*****.**', 'John Doe');
     $mail->setSender('*****@*****.**', 'Jane Doe');
     $mail->addBcc('*****@*****.**', 'Jim Doe');
     $mail->setSubject('Testing ExcludeHeaders');
     $mail->setBody('Jim should not get this email.');
     // BCC should be set at this point
     $this->assertTrue(strpos($mail->Mail->generateHeaders(), 'Bcc: Jim Doe <*****@*****.**>') > 0);
     // We don't care if the mail gets sent. What's important is what happens to the headers.
     eZMailTransport::send($mail);
     // BCC should not be set anymore at this point, because of ExcludeHeaders
     $this->assertFalse(strpos($mail->Mail->generateHeaders(), 'Bcc: Jim Doe <*****@*****.**>') > 0);
 }
 /**
  * Test for EZP-21986
  * Make sure the custom tag underline is transformed into a <u> tag
  *
  * @link https://jira.ez.no/browse/EZP-21986
  */
 public function testCustomUnderlineToU()
 {
     ezpINIHelper::setINISetting('content.ini', 'CustomTagSettings', 'AvailableCustomTags', array('underline'));
     ezpINIHelper::setINISetting('content.ini', 'CustomTagSettings', 'IsInline', array('underline' => 'true'));
     $xmlData = '<?xml version="1.0" encoding="utf-8"?>';
     $xmlData .= '<section xmlns:image="http://ez.no/namespaces/ezpublish3/image/"
         xmlns:xhtml="http://ez.no/namespaces/ezpublish3/xhtml/"
         xmlns:custom="http://ez.no/namespaces/ezpublish3/custom/">
         <paragraph>If I could <custom name="underline">sleep</custom> forever</paragraph>
     </section>';
     $folder = new ezpObject('folder', 2);
     $folder->name = 'The Dandy Warhols - Sleep';
     $folder->short_description = '';
     $oeHandler = new eZOEXMLInput($xmlData, false, $folder->short_description);
     $xhtml = $oeHandler->attribute('input_xml');
     self::assertEquals('&lt;p&gt;If I could &lt;u class=&quot;ezoeItemCustomTag underline&quot; type=&quot;custom&quot;&gt;sleep&lt;/u&gt; forever&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;', $xhtml);
     ezpINIHelper::restoreINISettings();
 }
Beispiel #20
0
 public function tearDown()
 {
     ezpINIHelper::restoreINISettings();
     unlink("tests/tests/lib/ezimage/data/andernach_small.jpg");
     parent::tearDown();
 }
 /**
  * Test for issue #16893: Wrong charset encoding in notification email
  */
 public function testRegressionSetContentTypeCharset()
 {
     // Set a custom charset in site.ini which will be tested
     // if it's set properly in the sent mail
     ezpINIHelper::setINISetting('site.ini', 'MailSettings', 'OutputCharset', 'custom-charset');
     $mail = new eZMail();
     $mail->setBody(__FUNCTION__);
     $ezcResult = $mail->Mail->generate();
     preg_match("/Content-Type: text\\/plain; charset=custom-charset/", $ezcResult, $matches);
     $this->assertEquals(1, count($matches));
 }
    /**
     * Test scenario for issue #18336: Alignment in table cells is not rendered
     * properly if RenderParagraphInTableCells=disabled
     *
     * With RenderParagraphInTableCells=disabled, check that the align
     * attribute of eZXML paragraph is taken into account while rendering the
     * table cell containing this paragraph.
     *
     * @group issue_18336
     * @link http://issues.ez.no/18336
     * @note Test depends on template output!!
     */
    function testRenderAlignInCellsWithoutParagraph()
    {
        ezpINIHelper::setINISetting( 'ezxml.ini', 'ezxhtml', 'RenderParagraphInTableCells', 'disabled' );
        $xml = '<?xml version="1.0" encoding="utf-8"?>
<section xmlns:image="http://ez.no/namespaces/ezpublish3/image/" xmlns:xhtml="http://ez.no/namespaces/ezpublish3/xhtml/" xmlns:custom="http://ez.no/namespaces/ezpublish3/custom/">
<paragraph><table width="100%" custom:summary="Test alignment" custom:caption=""><tr><td align="right"><paragraph align="left">align=left</paragraph></td></tr></table></paragraph>
</section>';
        $outputHandler = new eZXHTMLXMLOutput( $xml, false );
        $expected = '<table class="renderedtable" cellpadding="2" cellspacing="0" width="100%" summary="Test alignment">
<tr>
<td class=" text-left" valign="top">  align=left
  </td>
</tr>

</table>
';
        $this->assertEquals( $expected, $outputHandler->outputText() );
        ezpINIHelper::restoreINISettings();
    }
 /**
  * Regression test for issue {@see #23753 http://issues.ez.no/23753}
  *
  * In a multi language environment, an untranslated node fetched with default language will return the
  * full URL alias in the language of the node.
  */
 public function testIssue23753()
 {
     $bkpLanguages = eZContentLanguage::prioritizedLanguageCodes();
     $strNameEngGB = __FUNCTION__ . " eng-GB";
     $strNameFreFR = __FUNCTION__ . " fre-FR";
     // add a secondary language
     $locale = eZLocale::instance('fre-FR');
     $translation = eZContentLanguage::addLanguage($locale->localeCode(), $locale->internationalLanguageName());
     // set the prioritize language list to contain english
     eZContentLanguage::setPrioritizedLanguages(array('fre-FR', 'eng-GB'));
     // Create an object with data in fre-FR and eng-GB
     $folder = new ezpObject('folder', 2, 14, 1, 'eng-GB');
     $folder->publish();
     // Workaround as setting folder->name directly doesn't produce the expected result
     $folder->addTranslation('eng-GB', array('name' => $strNameEngGB));
     $folder->addTranslation('fre-FR', array('name' => $strNameFreFR));
     $article = new ezpObject('article', $folder->main_node_id, 14, 1, 'eng-GB');
     $article->publish();
     // Workaround as setting article->name directly doesn't produce the expected result
     $article->addTranslation('eng-GB', array('title' => $strNameEngGB));
     $nodeId = $article->main_node_id;
     // fetch the node with no default parameters. Should return the french URL Alias when applicable
     $node = eZContentObjectTreeNode::fetch($nodeId);
     self::assertEquals('testIssue23753-fre-FR/testIssue23753-eng-GB', $node->attribute('url_alias'));
     // fetch the node in english. Should return the full english URL Alias
     $node = eZContentObjectTreeNode::fetch($nodeId, 'eng-GB');
     self::assertEquals('testIssue23753-eng-GB/testIssue23753-eng-GB', $node->attribute('url_alias'));
     // Test that PathPrefix is correctly removed from UrlAlias
     ezpINIHelper::setINISetting('site.ini', 'SiteAccessSettings', 'PathPrefix', 'testIssue23753-fre-FR');
     $node = eZContentObjectTreeNode::fetch($nodeId);
     self::assertEquals('testIssue23753-eng-GB', $node->attribute('url_alias'));
     $folder->remove();
     $translation->removeThis();
     ezpINIHelper::restoreINISettings();
     eZContentLanguage::setPrioritizedLanguages($bkpLanguages);
 }
 public function tearDown()
 {
     $this->solrSearch->removeObject($this->testObj);
     ezpINIHelper::restoreINISettings();
     parent::tearDown();
 }
 public function tearDown()
 {
     ezpINIHelper::restoreINISettings();
     eZCache::clearByID('active_extensions');
     parent::tearDown();
 }
 /**
  * Sets the active extensions
  *
  * @param string $type ActiveExtensions or ActiveAccessExtensions
  * @param array $extensions Extensions to set as active ones
  */
 private static function setExtensions($extensions, $type = 'ActiveExtensions')
 {
     ezpINIHelper::setINISetting('site.ini', 'ExtensionSettings', $type, $extensions);
     self::clearActiveExtensionsCache();
 }
 public function tearDown()
 {
     ezpINIHelper::restoreINISettings();
 }
    /**
     * Same test as {@link self::testRemovePendingSearchOnDeleteObject()}, with class based delayed indexing
     * @group issue_17932
     */
    public function testRemovePendingSearchWithClassBasedIndexing()
    {
        // Activate delayed indexing for folder content class only
        ezpINIHelper::setINISetting( 'site.ini', 'SearchSettings', 'DelayedIndexing', 'classbased' );
        ezpINIHelper::setINISetting( 'site.ini', 'SearchSettings', 'DelayedIndexingClassList', array( 'folder' ) );

        eZContentOperationCollection::deleteObject( $this->nodeIds );
        $filterConds = array(
            'action'        => 'index_object',
            'param'         => array( array( $this->folder->object->attribute( 'id' ) ) )
        );
        $pendingCount = eZPersistentObject::count( eZPendingActions::definition(), $filterConds );
        self::assertEquals( 0, $pendingCount, 'eZContentOperationCollection::deleteObject() must remove pending action for objects #'.implode( ', ', $this->objectIds ) );
    }
    /**
     * Regression test for issue {@see #17632 http://issues.ez.no/17632}
     *
     * In a multi language environment, a node fetched with a language other than the prioritized one(s) will return the
     * URL alias in the prioritized language
     */
    public function testIssue17632()
    {
        $bkpLanguages = eZContentLanguage::prioritizedLanguageCodes();

        $strNameEngGB = __FUNCTION__ . " eng-GB";
        $strNameFreFR = __FUNCTION__ . " fre-FR";

        // add a secondary language
        $locale = eZLocale::instance( 'fre-FR' );
        $translation = eZContentLanguage::addLanguage( $locale->localeCode(), $locale->internationalLanguageName() );

        // set the prioritize language list to contain english
        // ezpINIHelper::setINISetting( 'site.ini', 'RegionalSettings', 'SiteLanguageList', array( 'fre-FR' ) );
        eZContentLanguage::setPrioritizedLanguages( array( 'fre-FR' ) );

        // Create an object with data in fre-FR and eng-GB
        $folder = new ezpObject( 'folder', 2, 14, 1, 'eng-GB' );
        $folder->publish();

        // Workaround as setting folder->name directly doesn't produce the expected result
        $folder->addTranslation( 'eng-GB', array( 'name' => $strNameEngGB ) );
        $folder->addTranslation( 'fre-FR', array( 'name' => $strNameFreFR ) );

        $nodeId = $folder->main_node_id;

        // fetch the node with no default parameters. Should return the french URL Alias
        $node = eZContentObjectTreeNode::fetch( $nodeId );
        self::assertEquals( 'testIssue17632-fre-FR' , $node->attribute( 'url_alias' ) );

        // fetch the node in english. Should return the english URL Alias
        $node = eZContentObjectTreeNode::fetch( $nodeId, 'eng-GB' );
        self::assertEquals( 'testIssue17632-eng-GB' , $node->attribute( 'url_alias' ) );

        ezpINIHelper::restoreINISettings();
        eZContentLanguage::setPrioritizedLanguages( $bkpLanguages );
    }
Beispiel #30
0
 /**
  * Ensures that eZURLAliasML::fetchPathByActionList() always uses prioritized languages,
  * even if a locale is enforced (3rd param) and always available flag is false.
  *
  * @see http://issues.ez.no/19055
  * @group issue19055
  * @covers eZURLAliasML::fetchPathByActionList
  */
 public function testFetchPathByActionListWithFallback()
 {
     $frenchLocale = $this->frenchLanguage->attribute('locale');
     ezpINIHelper::setINISettings(array(array('site.ini', 'RegionalSettings', 'ContentObjectLocale', $frenchLocale), array('site.ini', 'RegionalSettings', 'Locale', $frenchLocale), array('site.ini', 'RegionalSettings', 'SiteLanguageList', array($frenchLocale, 'eng-GB')), array('site.ini', 'RegionalSettings', 'ShowUntranslatedObjects', 'disabled')));
     eZContentOperationCollection::updateAlwaysAvailable(1, false);
     /*
      * - Create a content object in Norsk
      * - Remove AlwaysAvailable flag
      * - Add a translation in english
      * - Try to fetch path for this content in French (fallback is eng-GB as configured above)
      */
     $folder = new ezpObject('folder', 2, 14, 1, $this->norskLanguage->attribute('locale'));
     $folder->name = 'norsk folder';
     $folder->publish();
     eZContentOperationCollection::updateAlwaysAvailable($folder->object->attribute('id'), false);
     $folder->refresh();
     $folder->addTranslation('eng-GB', array('name' => 'english translation'));
     $folder->publish();
     $generatedPath = eZURLAliasML::fetchPathByActionList('eznode', array($folder->mainNode->node_id), $frenchLocale);
     self::assertNotNull($generatedPath);
     self::assertEquals('english-translation', $generatedPath);
     eZContentOperationCollection::updateAlwaysAvailable(1, true);
     ezpINIHelper::restoreINISettings();
     $folder->remove();
 }