PageRenderTime 36ms CodeModel.GetById 12ms RepoModel.GetById 0ms app.codeStats 0ms

/propelorm/test/testsuite/generator/behavior/nestedset/NestedSetBehaviorTest.php

https://bitbucket.org/franhb/propel
PHP | 48 lines | 27 code | 6 blank | 15 comment | 0 complexity | 8bbd2d9085e7e796a275376511d46be8 MD5 | raw file
Possible License(s): LGPL-3.0
  1. <?php
  2. /*
  3. * $Id$
  4. * This file is part of the Propel package.
  5. * For the full copyright and license information, please view the LICENSE
  6. * file that was distributed with this source code.
  7. *
  8. * @license MIT License
  9. */
  10. require_once dirname(__FILE__) . '/../../../../tools/helpers/bookstore/BookstoreTestBase.php';
  11. /**
  12. * Tests for NestedSetBehavior class
  13. *
  14. * @author Franรงois Zaninotto
  15. * @version $Revision$
  16. * @package generator.behavior.nestedset
  17. */
  18. class NestedSetBehaviorTest extends BookstoreTestBase
  19. {
  20. public function testDefault()
  21. {
  22. $table9 = Table9Peer::getTableMap();
  23. $this->assertEquals(count($table9->getColumns()), 5, 'nested_set adds three column by default');
  24. $this->assertTrue(method_exists('Table9', 'getTreeLeft'), 'nested_set adds a tree_left column by default');
  25. $this->assertTrue(method_exists('Table9', 'getLeftValue'), 'nested_set maps the left_value getter with the tree_left column');
  26. $this->assertTrue(method_exists('Table9', 'getTreeRight'), 'nested_set adds a tree_right column by default');
  27. $this->assertTrue(method_exists('Table9', 'getRightValue'), 'nested_set maps the right_value getter with the tree_right column');
  28. $this->assertTrue(method_exists('Table9', 'getTreeLevel'), 'nested_set adds a tree_level column by default');
  29. $this->assertTrue(method_exists('Table9', 'getLevel'), 'nested_set maps the level getter with the tree_level column');
  30. $this->assertFalse(method_exists('Table9', 'getTreeScope'), 'nested_set does not add a tree_scope column by default');
  31. $this->assertFalse(method_exists('Table9', 'getScopeValue'), 'nested_set does not map the scope_value getter with the tree_scope column by default');
  32. }
  33. public function testParameters()
  34. {
  35. $table10 = Table10Peer::getTableMap();
  36. $this->assertEquals(count($table10->getColumns()), 6, 'nested_set does not add columns when they already exist');
  37. $this->assertTrue(method_exists('Table10', 'getLeftValue'), 'nested_set maps the left_value getter with the tree_left column');
  38. $this->assertTrue(method_exists('Table10', 'getRightValue'), 'nested_set maps the right_value getter with the tree_right column');
  39. $this->assertTrue(method_exists('Table10', 'getLevel'), 'nested_set maps the level getter with the tree_level column');
  40. $this->assertTrue(method_exists('Table10', 'getScopeValue'), 'nested_set maps the scope_value getter with the tree_scope column when the use_scope parameter is true');
  41. }
  42. }