Location: PHPKode > projects > Xyster Framework > xyster-02build01/xyster-02build01/tests/Xyster/Controller/Request/ResourceTest.php
<?php
/**
 * Xyster Framework
 *
 * This source file is subject to the new BSD license that is bundled
 * with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://www.opensource.org/licenses/bsd-license.php
 *
 * @category  Xyster
 * @package   Xyster_Controller
 * @subpackage   UnitTests
 * @copyright Copyright LibreWorks, LLC (http://libreworks.net)
 * @license   http://www.opensource.org/licenses/bsd-license.php New BSD License
 * @version   $Id: ResourceTest.php 418 2010-10-18 21:40:08Z jonathanhawk $
 */
namespace XysterTest\Controller\Request;
use Xyster\Controller\Request\Resource;
/**
 * Test class for Xyster_Controller_Request_Resource.
 * Generated by PHPUnit on 2007-09-12 at 19:50:59.
 */
class Xyster_Controller_Request_ResourceTest extends \PHPUnit_Framework_TestCase
{
    /**
     * @var \Zend_Controller_Request_Http
     */
    protected $_request;

    /**
     * Sets up the fixture, for example, opens a network connection.
     * This method is called before a test is executed.
     *
     */
    protected function setUp()
    {
        $request = new \Zend_Controller_Request_Http();
        $request->setModuleName('foo');
        $request->setControllerName('bar');
        $request->setActionName('baz');
        $this->_request = $request;
    }

    /**
     * Tests creating a resource from a request object
     * 
     */
    public function testCreate()
    {
        $resource = Resource::create($this->_request);
        $this->assertType('\Xyster\Controller\Request\Resource', $resource);
    }

    /**
     * Tests the get* methods
     * 
     */
    public function testGetMethods()
    {
        $resource = Resource::create($this->_request);
        
        $request = $this->_request;
        $this->assertEquals($request->getModuleName(), $resource->getModule());
        $this->assertEquals($request->getControllerName(), $resource->getController());
        $this->assertEquals($request->getActionName(), $resource->getAction());
    }

    /**
     * Tests the getResourceId method
     * 
     */
    public function testGetResourceId()
    {
        $resource = Resource::create($this->_request);
        
        $this->assertEquals('MVC:foo/bar/baz', $resource->getResourceId());
    }

    /**
     * Tests the toString method
     * 
     */
    public function testToString()
    {
        $resource = Resource::create($this->_request);
        
        $this->assertEquals('MVC:foo/bar/baz', (string)$resource);
    }
}
Return current item: Xyster Framework