InflectorTest.php 781 B

1234567891011121314151617181920212223242526272829
  1. <?php
  2. include 'helpers/config.php';
  3. require_once __DIR__ . '/../lib/Inflector.php';
  4. class InflectorTest extends SnakeCase_PHPUnit_Framework_TestCase
  5. {
  6. public function set_up()
  7. {
  8. $this->inflector = ActiveRecord\Inflector::instance();
  9. }
  10. public function test_underscorify()
  11. {
  12. $this->assert_equals('rm__name__bob',$this->inflector->variablize('rm--name bob'));
  13. $this->assert_equals('One_Two_Three',$this->inflector->underscorify('OneTwoThree'));
  14. }
  15. public function test_tableize()
  16. {
  17. $this->assert_equals('angry_people',$this->inflector->tableize('AngryPerson'));
  18. $this->assert_equals('my_sqls',$this->inflector->tableize('MySQL'));
  19. }
  20. public function test_keyify()
  21. {
  22. $this->assert_equals('building_type_id', $this->inflector->keyify('BuildingType'));
  23. }
  24. };
  25. ?>