<?php


Mock::generate('Wact_Request_Parameter', 'MockParameter');

class WactTransitionBuilderTestCase extends Wact_Test_Case {

/*
    function testBuildControllerChainFromCommandPath() {
        $commandPath = '/';
        $controller = new Wact_Controller_Base();
        $controller->name = 'root';

        $builder = new WactTransitionBuilder();
        $chain = $builder->buildControllerChainFromCommandPath($controller, $commandPath);
        
        $this->assertIdentical(count($chain), 1);
        $this->assertIdentical($chain[0]->name, 'root');
    }

    function testBuildControllerChainFromCommandPath2() {
        $commandPath = '/test';
        $controller = new Wact_Controller_Base();
        $controller->name = 'root';
        $controller->addChild('test', new Wact_Controller_Base());

        $builder = new WactTransitionBuilder();
        $chain = $builder->buildControllerChainFromCommandPath($controller, $commandPath);
        
        $this->assertIdentical(count($chain), 2);
        $this->assertIdentical($chain[0]->name, 'root');
        $this->assertIdentical($chain[1]->name, 'test');
    }

    function testBuildControllerChainFromCommandPath3() {
        $commandPath = '/test1/test2';
        $controller = new Wact_Controller_Base();
        $controller->name = 'root';
        $test1 = new Wact_Controller_Base();
        $controller->addChild('test1', $test1);
        $test2 = new Wact_Controller_Base();
        $test1->addChild('test2', $test2);

        $builder = new WactTransitionBuilder();
        $chain = $builder->buildControllerChainFromCommandPath($controller, $commandPath);
        
        $this->assertIdentical(count($chain), 3);
        $this->assertIdentical($chain[0]->name, 'root');
        $this->assertIdentical($chain[1]->name, 'test1');
        $this->assertIdentical($chain[2]->name, 'test2');
    }

    function testBuildControllerChainFromCommandPath4() {
        $commandPath = '/';
        $controller = new Wact_Controller_Base();
        $controller->name = 'root';
        $controller->addChild('test', new Wact_Controller_Base());
        $controller->setDefaultChildName('test');

        $builder = new WactTransitionBuilder();
        $chain = $builder->buildControllerChainFromCommandPath($controller, $commandPath);
        
        $this->assertIdentical(count($chain), 1);
        $this->assertIdentical($chain[0]->name, 'root');
    }

    function testBuildCommandPathArrayFromChain() {
        $root = new Wact_Controller_Base();
        $root->name = 'root';
        $test1 = new Wact_Controller_Base();
        $test1->name = 'test1';
        $test2 = new Wact_Controller_Base();
        $test2->name = 'test2';
        $chain = array($root, $test1, $test2);

        $builder = new WactTransitionBuilder();
        $path = $builder->buildCommandPathArrayFromChain($chain);

        $this->assertIdentical($path, array('root', 'test1', 'test2'));
    }

    function testGetLastSharedPosition() {
        $chain = array('root', 'test1', 'test2');
        $builder = new WactTransitionBuilder();
        $this->assertIdentical($builder->getLastSharedPosition($chain, array()), 0);
        $this->assertIdentical($builder->getLastSharedPosition($chain, array('test1')), 1);
        $this->assertIdentical($builder->getLastSharedPosition($chain, array('test1', 'test2')), 2);
    }

    function testBuild() {
        $controller = new Wact_Controller_Base();
        $parameter = new MockParameter($this);
        $parameter->setReturnValue('getName', 'test');
        $controller->defineInput($parameter);

        $transition = new Wact_Controller_Transition_Link(
            $controller, '/', new Wact_Response_Model());
        $transition->build();

        $parameter->tally();
    }
*/

}

?>