RequestTest.php 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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-2015 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 Zend_Tool_Framework_Client_Request
  24. */
  25. require_once 'Zend/Tool/Framework/Client/Request.php';
  26. /**
  27. * @category Zend
  28. * @package Zend_Tool
  29. * @subpackage UnitTests
  30. * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
  31. * @license http://framework.zend.com/license/new-bsd New BSD License
  32. *
  33. * @group Zend_Tool
  34. * @group Zend_Tool_Framework
  35. * @group Zend_Tool_Framework_Client
  36. */
  37. class Zend_Tool_Framework_Client_RequestTest extends PHPUnit_Framework_TestCase
  38. {
  39. /**
  40. * @var Zend_Tool_Framework_Client_Request
  41. */
  42. protected $_request = null;
  43. public function setup()
  44. {
  45. $this->_request = new Zend_Tool_Framework_Client_Request();
  46. }
  47. public function testProviderNameGetterAndSetter()
  48. {
  49. $this->_request->setProviderName('foo');
  50. $this->assertEquals('foo', $this->_request->getProviderName());
  51. }
  52. public function testSpecialtyNameGetterAndSetter()
  53. {
  54. $this->_request->setSpecialtyName('foo');
  55. $this->assertEquals('foo', $this->_request->getSpecialtyName());
  56. }
  57. public function testActionNameGetterAndSetter()
  58. {
  59. $this->_request->setActionName('foo');
  60. $this->assertEquals('foo', $this->_request->getActionName());
  61. }
  62. public function testActionParametersGetterAndSetter()
  63. {
  64. $this->_request->setActionParameter('foo', 'bar');
  65. $this->_request->setActionParameter('bar', 'baz');
  66. $this->assertEquals('bar', $this->_request->getActionParameter('foo'));
  67. $this->assertArrayHasKey('foo', $this->_request->getActionParameters());
  68. $this->assertArrayHasKey('bar', $this->_request->getActionParameters());
  69. $this->assertEquals(2, count($this->_request->getActionParameters()));
  70. }
  71. public function testProviderParameterGetterAndSetter()
  72. {
  73. $this->_request->setProviderParameter('foo', 'bar');
  74. $this->_request->setProviderParameter('bar', 'baz');
  75. $this->assertEquals('bar', $this->_request->getProviderParameter('foo'));
  76. $this->assertArrayHasKey('foo', $this->_request->getProviderParameters());
  77. $this->assertArrayHasKey('bar', $this->_request->getProviderParameters());
  78. $this->assertEquals(2, count($this->_request->getProviderParameters()));
  79. }
  80. public function testPretendGetterAndSetter()
  81. {
  82. $this->assertFalse($this->_request->isPretend());
  83. $this->_request->setPretend(true);
  84. $this->assertTrue($this->_request->isPretend());
  85. }
  86. public function testDispatchableGetterAndSetter()
  87. {
  88. $this->assertTrue($this->_request->isDispatchable());
  89. $this->_request->setDispatchable(false);
  90. $this->assertFalse($this->_request->isDispatchable());
  91. }
  92. /*
  93. protected $_providerName = null;
  94. protected $_specialtyName = null;
  95. protected $_actionName = null;
  96. protected $_actionParameters = array();
  97. protected $_providerParameters = array();
  98. protected $_isPretend = false;
  99. protected $_isDispatchable = true;
  100. */
  101. }