当前位置: 首页>>代码示例>>PHP>>正文


PHP Inflector::reset方法代码示例

本文整理汇总了PHP中lithium\util\Inflector::reset方法的典型用法代码示例。如果您正苦于以下问题:PHP Inflector::reset方法的具体用法?PHP Inflector::reset怎么用?PHP Inflector::reset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在lithium\util\Inflector的用法示例。


在下文中一共展示了Inflector::reset方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setUp

 public function setUp()
 {
     $this->_backups['catalogConfig'] = Catalog::config();
     Catalog::reset();
     Catalog::config(array('runtime' => array('adapter' => new Memory())));
     Inflector::reset();
 }
开发者ID:kdambekalns,项目名称:framework-benchs,代码行数:7,代码来源:CatalogInflectorTest.php

示例2: tearDown

 public function tearDown()
 {
     Inflector::reset();
     Catalog::reset();
     Catalog::config($this->_backup['catalogConfig']);
 }
开发者ID:nilamdoc,项目名称:KYCGlobal,代码行数:6,代码来源:CatalogInflectorTest.php

示例3: testAddTransliterations

 /**
  * Tests adding transliterated characters to the map used in `Inflector::slug()`.
  *
  * @return void
  */
 public function testAddTransliterations()
 {
     $this->assertEqual(Inflector::slug('Montréal'), 'Montreal');
     $this->assertNotEqual(Inflector::slug('Écaussines'), 'Ecaussines');
     Inflector::rules('transliteration', array('/É|Ê/' => 'E'));
     $this->assertEqual(Inflector::slug('Écaussines-d\'Enghien'), 'Ecaussines-d-Enghien');
     $this->assertNotEqual(Inflector::slug('JØRGEN'), 'JORGEN');
     Inflector::rules('transliteration', array('/Ø/' => 'O'));
     $this->assertEqual(Inflector::slug('JØRGEN'), 'JORGEN');
     $this->assertNotEqual(Inflector::slug('ÎÍ'), 'II');
     Inflector::rules('transliteration', array('/Î|Í/' => 'I'));
     $this->assertEqual(Inflector::slug('ÎÍ'), 'II');
     $this->assertEqual(Inflector::slug('ABc'), 'ABc');
     Inflector::rules('transliteration', array('AB' => 'a'));
     Inflector::reset();
     $this->assertEqual(Inflector::slug('ABc'), 'aac');
 }
开发者ID:kdambekalns,项目名称:framework-benchs,代码行数:22,代码来源:InflectorTest.php

示例4: testStorageMechanism

 /**
  * Tests the storage mechanism for `$_underscored`, `$_camelized`,
  *  `$_humanized` and `$_pluralized`.
  *
  * @return void
  */
 public function testStorageMechanism()
 {
     Inflector::reset();
     $expected = array('TestField' => 'test_field');
     $this->assertFalse($this->getProtectedValue('$_underscored'));
     $this->assertEqual(Inflector::underscore('TestField'), 'test_field');
     $this->assertEqual($expected, $this->getProtectedValue('$_underscored'));
     $this->assertEqual(Inflector::underscore('TestField'), 'test_field');
     $expected = array('test_field' => 'TestField');
     $this->assertFalse($this->getProtectedValue('$_camelized'));
     $this->assertEqual(Inflector::camelize('test_field', true), 'TestField');
     $this->assertEqual($expected, $this->getProtectedValue('$_camelized'));
     $this->assertEqual(Inflector::camelize('test_field', true), 'TestField');
     $expected = array('test_field:_' => 'Test Field');
     $this->assertFalse($this->getProtectedValue('$_humanized'));
     $this->assertEqual(Inflector::humanize('test_field'), 'Test Field');
     $this->assertEqual($expected, $this->getProtectedValue('$_humanized'));
     $this->assertEqual(Inflector::humanize('test_field'), 'Test Field');
     $expected = array('field' => 'fields');
     $this->assertFalse($this->getProtectedValue('$_pluralized'));
     $this->assertEqual(Inflector::pluralize('field'), 'fields');
     $this->assertEqual($expected, $this->getProtectedValue('$_pluralized'));
     $this->assertEqual(Inflector::pluralize('field'), 'fields');
 }
开发者ID:nashadalam,项目名称:lithium,代码行数:30,代码来源:InflectorTest.php

示例5: testAddingSingularizationRules

 public function testAddingSingularizationRules()
 {
     $before = Inflector::rules('singular');
     $result = Inflector::singularize('errata');
     $this->assertNull(Inflector::rules('singular', array('/rata/' => '\\1ratus')));
     $this->assertEqual(Inflector::singularize('errata'), $result);
     Inflector::reset();
     $this->assertNotEqual(Inflector::singularize('errata'), $result);
     $after = Inflector::rules('singular');
     $expected = array('rules', 'irregular', 'uninflected', 'regexUninflected', 'regexIrregular');
     $this->assertEqual(array_keys($before), $expected);
     $this->assertEqual(array_keys($after), $expected);
     $result = array_diff($after['rules'], $before['rules']);
     $this->assertEqual($result, array('/rata/' => '\\1ratus'));
     foreach (array('irregular', 'uninflected', 'regexUninflected', 'regexIrregular') as $key) {
         $this->assertIdentical($before[$key], $after[$key]);
     }
     $this->assertNull(Inflector::rules('singular', array('rules' => array('/rata/' => '\\1ratus'))));
     $this->assertIdentical(Inflector::rules('singular'), $after);
 }
开发者ID:EHER,项目名称:chegamos,代码行数:20,代码来源:InflectorTest.php


注:本文中的lithium\util\Inflector::reset方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。