RequestTest.php 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. <?php
  2. /**
  3. * Zend Framework
  4. *
  5. * LICENSE
  6. *
  7. * This source file is subject to the new BSD license that is bundled
  8. * with this package in the file LICENSE.txt.
  9. * It is also available through the world-wide-web at this URL:
  10. * http://framework.zend.com/license/new-bsd
  11. * If you did not receive a copy of the license and are unable to
  12. * obtain it through the world-wide-web, please send an email
  13. * to license@zend.com so we can send you a copy immediately.
  14. *
  15. * @category Zend
  16. * @package Zend_Tool
  17. * @subpackage UnitTests
  18. * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
  19. * @license http://framework.zend.com/license/new-bsd New BSD License
  20. * @version $Id$
  21. */
  22. /**
  23. * @see TestHelper.php
  24. */
  25. require_once dirname(__FILE__) . '/../../../../TestHelper.php';
  26. /**
  27. * @see Zend_Tool_Framework_Client_Request
  28. */
  29. require_once 'Zend/Tool/Framework/Client/Request.php';
  30. /**
  31. * @category Zend
  32. * @package Zend_Tool
  33. * @subpackage UnitTests
  34. * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
  35. * @license http://framework.zend.com/license/new-bsd New BSD License
  36. *
  37. * @group Zend_Tool
  38. * @group Zend_Tool_Framework
  39. * @group Zend_Tool_Framework_Client
  40. */
  41. class Zend_Tool_Framework_Client_RequestTest extends PHPUnit_Framework_TestCase
  42. {
  43. /**
  44. * @var Zend_Tool_Framework_Client_Request
  45. */
  46. protected $_request = null;
  47. public function setup()
  48. {
  49. $this->_request = new Zend_Tool_Framework_Client_Request();
  50. }
  51. public function testProviderNameGetterAndSetter()
  52. {
  53. $this->_request->setProviderName('foo');
  54. $this->assertEquals('foo', $this->_request->getProviderName());
  55. }
  56. public function testSpecialtyNameGetterAndSetter()
  57. {
  58. $this->_request->setSpecialtyName('foo');
  59. $this->assertEquals('foo', $this->_request->getSpecialtyName());
  60. }
  61. public function testActionNameGetterAndSetter()
  62. {
  63. $this->_request->setActionName('foo');
  64. $this->assertEquals('foo', $this->_request->getActionName());
  65. }
  66. public function testActionParametersGetterAndSetter()
  67. {
  68. $this->_request->setActionParameter('foo', 'bar');
  69. $this->_request->setActionParameter('bar', 'baz');
  70. $this->assertEquals('bar', $this->_request->getActionParameter('foo'));
  71. $this->assertArrayHasKey('foo', $this->_request->getActionParameters());
  72. $this->assertArrayHasKey('bar', $this->_request->getActionParameters());
  73. $this->assertEquals(2, count($this->_request->getActionParameters()));
  74. }
  75. public function testProviderParameterGetterAndSetter()
  76. {
  77. $this->_request->setProviderParameter('foo', 'bar');
  78. $this->_request->setProviderParameter('bar', 'baz');
  79. $this->assertEquals('bar', $this->_request->getProviderParameter('foo'));
  80. $this->assertArrayHasKey('foo', $this->_request->getProviderParameters());
  81. $this->assertArrayHasKey('bar', $this->_request->getProviderParameters());
  82. $this->assertEquals(2, count($this->_request->getProviderParameters()));
  83. }
  84. public function testPretendGetterAndSetter()
  85. {
  86. $this->assertFalse($this->_request->isPretend());
  87. $this->_request->setPretend(true);
  88. $this->assertTrue($this->_request->isPretend());
  89. }
  90. public function testDispatchableGetterAndSetter()
  91. {
  92. $this->assertTrue($this->_request->isDispatchable());
  93. $this->_request->setDispatchable(false);
  94. $this->assertFalse($this->_request->isDispatchable());
  95. }
  96. /*
  97. protected $_providerName = null;
  98. protected $_specialtyName = null;
  99. protected $_actionName = null;
  100. protected $_actionParameters = array();
  101. protected $_providerParameters = array();
  102. protected $_isPretend = false;
  103. protected $_isDispatchable = true;
  104. */
  105. }