本文整理汇总了PHP中ezpINIHelper::restoreINISettings方法的典型用法代码示例。如果您正苦于以下问题:PHP ezpINIHelper::restoreINISettings方法的具体用法?PHP ezpINIHelper::restoreINISettings怎么用?PHP ezpINIHelper::restoreINISettings使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ezpINIHelper
的用法示例。
在下文中一共展示了ezpINIHelper::restoreINISettings方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testGetLanguageCore
/**
* 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();
}
示例2: tearDown
public function tearDown()
{
ezpINIHelper::restoreINISettings();
$this->event = null;
ezpEvent::resetInstance();
parent::tearDown();
}
示例3: testLinksAcrossTranslations
/**
* 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);
}
示例4: tearDown
public function tearDown()
{
ezpINIHelper::restoreINISettings();
eZClusterFileHandler::resetHandler();
parent::tearDown();
}
示例5: tearDown
public function tearDown()
{
$this->testURI = null;
$this->postParams = array();
ezpINIHelper::restoreINISettings();
parent::tearDown();
}
示例6: testIssue13497
/**
* 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();
}
示例7: testFetchTranslatedNamesSort
/**
* 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" );
}
示例8: tearDown
public function tearDown()
{
ezpINIHelper::restoreINISettings();
if (isset($GLOBALS['eZClusterFileHandler_chosen_handler'])) {
unset($GLOBALS['eZClusterFileHandler_chosen_handler']);
}
parent::tearDown();
}
示例9: tearDown
public function tearDown()
{
$this->solrSearch->removeObject($this->object->object);
$this->object->remove();
$this->object = null;
$this->solrSearch = null;
ezpINIHelper::restoreINISettings();
parent::tearDown();
}
示例10: tearDown
public function tearDown()
{
ezpINIHelper::restoreINISettings();
eZClusterFileHandler::resetHandler();
if ($this->haveToRemoveDFSPath) {
eZDir::recursiveDelete(self::$DFSPath);
}
parent::tearDown();
}
示例11: testGetFilter
/**
* 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();
}
示例12: testVersionHistoryLimitWithObjectParameter
/**
* 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();
}
示例13: testURLAliasSplitParentTranslation
//.........这里部分代码省略.........
{
ezpINIHelper::setINISetting(
'site.ini', 'RegionalSettings',
'SiteLanguageList', array( 'eng-GB', 'nor-NO' )
);
eZContentLanguage::clearPrioritizedLanguages();
$db = eZDB::instance();
// STEP 1: Add test folder
$folder = new ezpObject( "folder", 2 );
$folder->name = __FUNCTION__;
$folder->publish();
// STEP 2: Add child below folder
$child = new ezpObject( "folder", $folder->mainNode->node_id );
$child->name = "Child" . __FUNCTION__;
$child->publish();
// Sub-sub children disabled for now, might be used in future, for
// further assertions.
// // STEP 2a: Add a sub-sub child
// $subChild1 = new ezpObject( 'article', $child->mainNode->node_id );
// $subChild1->title = "SubChild";
// $subChild1->publish();
//
// // STEP 2b: Add a sub-sub child
// $subChild2 = new ezpObject( 'article', $child->mainNode->node_id );
// $subChild2->title = "SubChildOther";
// $subChild2->publish();
//
// // STEP 2ba: Adding sub-sub child translation
// $norSubChild2Trans = array( "title" => "SubChildOtherNor" );
// $subChild2->addTranslation( "nor-NO", $norSubChild2Trans );
//
// // STEP 2c: Add a sub-sub child
// $subChild3 = new ezpObject( 'article', $child->mainNode->node_id );
// $subChild3->title = "SubChildThird";
// $subChild3->publish();
//
// // STEP 2ca: Addubg sub-sub child translation
// $norSubChild3Trans = array( "title" => "SubChildThird" );
// $subChild3->addTranslation( "nor-NO", $norSubChild3Trans );
// STEP 3: Add translation to child with the same name
$translationAttributes = array( "name" => "Child" . __FUNCTION__ );
$child->addTranslation( "nor-NO", $translationAttributes );
// STEP 4: Update the translation
$child->refresh();
$newVersion = $child->createNewVersion( false, true, 'nor-NO' );
$norDataMap = $child->fetchDataMap( $newVersion->attribute( 'version' ), "nor-NO" );
$norDataMap['name']->setAttribute( 'data_text', 'NorChildChanged' . __FUNCTION__ );
$norDataMap['name']->store();
ezpObject::publishContentObject( $child->object, $newVersion );
// STEP 5:
$child->refresh();
$child->name = "Renamed child" . __FUNCTION__;
$child->publish();
// STEP 6:
$child->refresh();
$child->name = "Child changed" . __FUNCTION__;
$child->publish();
// STEP 7:
$child->refresh();
$newVersion = $child->createNewVersion( false, true, 'nor-NO' );
$norDataMap = $child->fetchDataMap( $newVersion->attribute( 'version' ), "nor-NO" );
$norDataMap['name']->setAttribute( 'data_text', 'NorChildChanged again' . __FUNCTION__ );
$norDataMap['name']->store();
ezpObject::publishContentObject( $child->object, $newVersion );
// STEP 8:
$child->refresh();
$newVersion = $child->createNewVersion( false, true, 'nor-NO' );
$norDataMap = $child->fetchDataMap( $newVersion->attribute( 'version' ), "nor-NO" );
$norDataMap['name']->setAttribute( 'data_text', 'Child changed' . __FUNCTION__ );
$norDataMap['name']->store();
ezpObject::publishContentObject( $child->object, $newVersion );
// STEP 9:
$child->refresh();
$newVersion = $child->createNewVersion( false, true, 'nor-NO' );
$norDataMap = $child->fetchDataMap( $newVersion->attribute( 'version' ), "nor-NO" );
$norDataMap['name']->setAttribute( 'data_text', 'NorChildChanged again' . __FUNCTION__ );
$norDataMap['name']->store();
ezpObject::publishContentObject( $child->object, $newVersion );
$query = self::buildSql( array( $child->mainNode->node_id ) );
$result = $db->arrayQuery( $query );
$initialTranslationChild = self::urlEntryForName( "Child-changed" . __FUNCTION__, $result );
$translationChild = self::urlEntryForName( 'NorChildChanged-again' . __FUNCTION__, $result );
self::assertEquals( (int)$initialTranslationChild['id'], (int)$translationChild['id'], "Current translations of the same node need to have the same id." );
ezpINIHelper::restoreINISettings();
}
示例14: testNonASCIICharsInName
/**
* Tests if having non ascii characters in the ezcontentobject name will
* generate correct URLs.
*/
public function testNonASCIICharsInName()
{
// We add a random number to the end of the name and URL so we
// are sure to get unique URLs without any crud (__1, __2, etc).
// Without unique URLs we cannot predict what the URL for the name
// will be.
$randomNumber = mt_rand();
$nonAsciiName = "Noñ äcsíí ©ha®ß ïn ñámé ウ… " . $randomNumber;
$nonAsciiNameURL = "Noñ-äcsíí-©ha®ß-ïn-ñámé-ウ…-" . $randomNumber;
// Before we start set the correct URL transformation settings.
ezpINIHelper::setINISetting('site.ini', 'URLTranslator', 'WordSeparator', 'dash');
ezpINIHelper::setINISetting('site.ini', 'URLTranslator', 'TransformationGroup', 'urlalias_iri');
// STEP 1: Create test folder
$folder = new ezpObject("folder", 2);
$folder->name = "Test Folder: {$nonAsciiName}";
$folder->publish();
// STEP 2: Create sub folder with apostrophe in the name
$subfolder = new ezpObject("folder", $folder->mainNode->node_id);
$subfolder->name = "{$nonAsciiName}";
$subfolder->publish();
// STEP 3: Add a child node
$subfolder->addNode(2);
// STEP 4: Test for success:
$this->assertEquals($nonAsciiNameURL, $subfolder->nodes[1]->pathWithNames());
// Restore ini settings to their original values
ezpINIHelper::restoreINISettings();
}
示例15: testConvertToAlias_Compat
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();
}