PageRenderTime 9ms CodeModel.GetById 1ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

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

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