本文整理汇总了PHP中ezpINIHelper类的典型用法代码示例。如果您正苦于以下问题:PHP ezpINIHelper类的具体用法?PHP ezpINIHelper怎么用?PHP ezpINIHelper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ezpINIHelper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: tearDown
public function tearDown()
{
ezpINIHelper::restoreINISettings();
$this->event = null;
ezpEvent::resetInstance();
parent::tearDown();
}
示例2: tearDown
public function tearDown()
{
ezpINIHelper::restoreINISettings();
eZClusterFileHandler::resetHandler();
parent::tearDown();
}
示例3: testSendHTTPRequestException
/**
* 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);
}
示例4: 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();
}
示例5: 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();
}
示例6: 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" );
}
示例7: 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);
}
示例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()
{
ezpINIHelper::restoreINISettings();
eZClusterFileHandler::resetHandler();
if ($this->haveToRemoveDFSPath) {
eZDir::recursiveDelete(self::$DFSPath);
}
parent::tearDown();
}
示例10: tearDown
public function tearDown()
{
$this->solrSearch->removeObject($this->object->object);
$this->object->remove();
$this->object = null;
$this->solrSearch = null;
ezpINIHelper::restoreINISettings();
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: testPasswordHashSamePasswordToUser
/**
* 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 = '{$this->username}'" );
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 = '{$this->username}'" );
$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.");
}
}
示例14: 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();
}
示例15: testIsEnabledBadSetting
/**
* 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());
}