testValue = ''; } public function indexAction() { $this->testValue = 'indexAction'; } public function getAction() { $this->testValue = 'getAction'; } public function postAction() { $this->testValue = 'postAction'; } public function putAction() { $this->testValue = 'putAction'; } public function deleteAction() { $this->testValue = 'deleteAction'; } } /** * @category Zend * @package Zend_Rest * @subpackage UnitTests * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @group Zend_Rest */ class Zend_Rest_ControllerTest extends PHPUnit_Framework_TestCase { protected $_testController; /** * Runs the test methods of this class. * * @access public * @static */ public static function main() { require_once "PHPUnit/TextUI/TestRunner.php"; $suite = new PHPUnit_Framework_TestSuite("Zend_Rest_ControllerTest"); $result = PHPUnit_TextUI_TestRunner::run($suite); } public function setUp() { $request = new Zend_Controller_Request_HttpTestCase(); $response = new Zend_Controller_Response_HttpTestCase(); $this->_testController = new Zend_Rest_TestController($request, $response); } public function test_action_methods() { $this->_testController->indexAction(); $this->assertEquals('indexAction', $this->_testController->testValue); $this->_testController->getAction(); $this->assertEquals('getAction', $this->_testController->testValue); $this->_testController->postAction(); $this->assertEquals('postAction', $this->_testController->testValue); $this->_testController->putAction(); $this->assertEquals('putAction', $this->_testController->testValue); $this->_testController->deleteAction(); $this->assertEquals('deleteAction', $this->_testController->testValue); } } // Call Zend_Rest_ControllerTest::main() if this source file is executed directly. if (PHPUnit_MAIN_METHOD == "Zend_Rest_ControllerTest::main") { Zend_Rest_ControllerTest::main(); }