[ Index ]

PHP Cross Reference of Limb3

title

Body

[close]

/core/tests/cases/ -> lmbCoreUtilsTest.class.php (source)

   1  <?php
   2  /*

   3   * Limb PHP Framework

   4   *

   5   * @link http://limb-project.com

   6   * @copyright  Copyright &copy; 2004-2007 BIT(http://bit-creative.com)

   7   * @license    LGPL http://www.gnu.org/copyleft/lesser.html

   8   */
   9  
  10  class lmbCoreUtilsTest extends UnitTestCase
  11  {
  12    function testCamelCaseUcfirst()
  13    {
  14      $this->assertEqual(lmb_camel_case('foo'), 'Foo');
  15      $this->assertEqual(lmb_camel_case('foo_bar'), 'FooBar');
  16      $this->assertEqual(lmb_camel_case('foo168_bar'), 'Foo168Bar');
  17      $this->assertEqual(lmb_camel_case('foo_bar_hey_wow'), 'FooBarHeyWow');
  18      $this->assertEqual(lmb_camel_case('_foo_bar'), '_FooBar');
  19      $this->assertEqual(lmb_camel_case('_foo_bar_'), '_FooBar_');
  20      $this->assertEqual(lmb_camel_case('___foo___bar'), '___Foo_Bar');
  21      $this->assertEqual(lmb_camel_case('___foo___bar_hey'), '___Foo_BarHey');
  22    }
  23  
  24    function testCamelCaseDontUcfirst()
  25    {
  26      $this->assertEqual(lmb_camel_case('foo', false), 'foo');
  27      $this->assertEqual(lmb_camel_case('foo_bar', false), 'fooBar');
  28      $this->assertEqual(lmb_camel_case('foo168_bar', false), 'foo168Bar');
  29      $this->assertEqual(lmb_camel_case('foo_bar_hey_wow', false), 'fooBarHeyWow');
  30      $this->assertEqual(lmb_camel_case('_foo_bar', false), '_fooBar');
  31      $this->assertEqual(lmb_camel_case('_foo_bar_', false), '_fooBar_');
  32      $this->assertEqual(lmb_camel_case('___foo___bar', false), '___foo_Bar');
  33      $this->assertEqual(lmb_camel_case('___foo___bar_hey', false), '___foo_BarHey');
  34    }
  35    
  36    function testUnderScores()
  37    {
  38      $this->assertEqual(lmb_under_scores('FooBar'), 'foo_bar');
  39      $this->assertEqual(lmb_under_scores('Foo168Bar'), 'foo168_bar');
  40      $this->assertEqual(lmb_under_scores('FooBarZoo'), 'foo_bar_zoo');
  41      $this->assertEqual(lmb_under_scores('_FooBarZoo'), '_foo_bar_zoo');
  42      $this->assertEqual(lmb_under_scores('_FooBarZoo_'), '_foo_bar_zoo_');
  43    }
  44  }
  45  ?>


Generated: Tue Oct 7 05:02:03 2008 Cross-referenced by PHPXref 0.7