PageRenderTime 35ms CodeModel.GetById 10ms RepoModel.GetById 1ms app.codeStats 0ms

/propel_17/vendor/propel/test/testsuite/generator/behavior/nestedset/NestedSetBehaviorWithNamespaceTest.php

http://github.com/eventhorizonpl/forked-php-orm-benchmark
PHP | 59 lines | 43 code | 9 blank | 7 comment | 1 complexity | a7ee2a13de9361c8c1c903155c8cf91c MD5 | raw file
Possible License(s): LGPL-2.1, LGPL-3.0
  1. <?php
  2. /*
  3. * This file is part of the Propel package.
  4. * For the full copyright and license information, please view the LICENSE
  5. * file that was distributed with this source code.
  6. *
  7. * @license MIT License
  8. */
  9. require_once dirname(__FILE__) . '/../../../../tools/helpers/bookstore/BookstoreTestBase.php';
  10. require_once dirname(__FILE__) . '/../../../../../generator/lib/util/PropelQuickBuilder.php';
  11. require_once dirname(__FILE__) . '/../../../../../generator/lib/behavior/nestedset/NestedSetBehavior.php';
  12. require_once dirname(__FILE__) . '/../../../../../runtime/lib/Propel.php';
  13. class NestedSetBehaviorWithNamespaceTest extends BookstoreTestBase
  14. {
  15. public function setUp()
  16. {
  17. parent::setUp();
  18. if (!class_exists('My\NestedSet1')) {
  19. $schema = <<<EOF
  20. <database name="nested_set_database" namespace="My">
  21. <table name="nested_set_1">
  22. <column name="id" required="true" primaryKey="true" autoIncrement="true" type="INTEGER" />
  23. <column name="title" type="VARCHAR" size="100" primaryString="true" />
  24. <behavior name="nested_set" />
  25. </table>
  26. </database>
  27. EOF;
  28. $builder = new PropelQuickBuilder();
  29. $builder->setSchema($schema);
  30. $builder->build();
  31. }
  32. }
  33. public function testActiveRecordApi()
  34. {
  35. $this->assertTrue(method_exists('My\NestedSet1', 'getTreeLeft'), 'nested_set adds a tree_left column by default');
  36. $this->assertTrue(method_exists('My\NestedSet1', 'getLeftValue'), 'nested_set maps the left_value getter with the tree_left column');
  37. $this->assertTrue(method_exists('My\NestedSet1', 'getTreeRight'), 'nested_set adds a tree_right column by default');
  38. $this->assertTrue(method_exists('My\NestedSet1', 'getRightValue'), 'nested_set maps the right_value getter with the tree_right column');
  39. $this->assertTrue(method_exists('My\NestedSet1', 'getTreeLevel'), 'nested_set adds a tree_level column by default');
  40. $this->assertTrue(method_exists('My\NestedSet1', 'getLevel'), 'nested_set maps the level getter with the tree_level column');
  41. $this->assertFalse(method_exists('My\NestedSet1', 'getTreeScope'), 'nested_set does not add a tree_scope column by default');
  42. $this->assertFalse(method_exists('My\NestedSet1', 'getScopeValue'), 'nested_set does not map the scope_value getter with the tree_scope column by default');
  43. }
  44. public function testAddChild()
  45. {
  46. $obj1 = new \My\NestedSet1();
  47. $obj1->save();
  48. $obj1->addChild(new \My\NestedSet1());
  49. }
  50. }