PageRenderTime 53ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/tests/Propel/Tests/Generator/Behavior/NestedSet/NestedSetBehaviorTest.php

http://github.com/propelorm/Propel2
PHP | 52 lines | 29 code | 7 blank | 16 comment | 0 complexity | 0ac052606a622aed12217607506faa24 MD5 | raw file
  1. <?php
  2. /**
  3. * MIT License. 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. namespace Propel\Tests\Generator\Behavior\NestedSet;
  8. use Map\NestedSetTable10TableMap;
  9. use Map\NestedSetTable9TableMap;
  10. /**
  11. * Tests for NestedSetBehavior class
  12. *
  13. * @author François Zaninotto
  14. */
  15. class NestedSetBehaviorTest extends TestCase
  16. {
  17. /**
  18. * @return void
  19. */
  20. public function testDefault()
  21. {
  22. $table9 = NestedSetTable9TableMap::getTableMap();
  23. $this->assertEquals(count($table9->getColumns()), 5, 'nested_set adds three column by default');
  24. $this->assertTrue(method_exists('NestedSetTable9', 'getTreeLeft'), 'nested_set adds a tree_left column by default');
  25. $this->assertTrue(method_exists('NestedSetTable9', 'getLeftValue'), 'nested_set maps the left_value getter with the tree_left column');
  26. $this->assertTrue(method_exists('NestedSetTable9', 'getTreeRight'), 'nested_set adds a tree_right column by default');
  27. $this->assertTrue(method_exists('NestedSetTable9', 'getRightValue'), 'nested_set maps the right_value getter with the tree_right column');
  28. $this->assertTrue(method_exists('NestedSetTable9', 'getTreeLevel'), 'nested_set adds a tree_level column by default');
  29. $this->assertTrue(method_exists('NestedSetTable9', 'getLevel'), 'nested_set maps the level getter with the tree_level column');
  30. $this->assertFalse(method_exists('NestedSetTable9', 'getTreeScope'), 'nested_set does not add a tree_scope column by default');
  31. $this->assertFalse(method_exists('NestedSetTable9', 'getScopeValue'), 'nested_set does not map the scope_value getter with the tree_scope column by default');
  32. }
  33. /**
  34. * @return void
  35. */
  36. public function testParameters()
  37. {
  38. $table10 = NestedSetTable10TableMap::getTableMap();
  39. $this->assertEquals(count($table10->getColumns()), 6, 'nested_set does not add columns when they already exist');
  40. $this->assertTrue(method_exists('NestedSetTable10', 'getLeftValue'), 'nested_set maps the left_value getter with the tree_left column');
  41. $this->assertTrue(method_exists('NestedSetTable10', 'getRightValue'), 'nested_set maps the right_value getter with the tree_right column');
  42. $this->assertTrue(method_exists('NestedSetTable10', 'getLevel'), 'nested_set maps the level getter with the tree_level column');
  43. $this->assertTrue(method_exists('NestedSetTable10', 'getScopeValue'), 'nested_set maps the scope_value getter with the tree_scope column when the use_scope parameter is true');
  44. }
  45. }