NamespaceTest.php 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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_Controller
  17. * @subpackage UnitTests
  18. * @copyright Copyright (c) 2005-2014 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. if (!defined('PHPUnit_MAIN_METHOD')) {
  23. define('PHPUnit_MAIN_METHOD', 'Zend_Controller_Action_Helper_NamespaceTest::main');
  24. }
  25. /**
  26. * Test class for Zend_Controller_Action_Helper_Abstract.
  27. *
  28. * @category Zend
  29. * @package Zend_Controller
  30. * @subpackage UnitTests
  31. * @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
  32. * @license http://framework.zend.com/license/new-bsd New BSD License
  33. * @group Zend_Controller
  34. * @group Zend_Controller_Action
  35. * @group Zend_Controller_Action_Helper
  36. */
  37. class Zend_Controller_Action_Helper_NamespaceTest extends PHPUnit_Framework_TestCase
  38. {
  39. /**
  40. * Runs the test methods of this class.
  41. *
  42. * @return void
  43. */
  44. public static function main()
  45. {
  46. $suite = new PHPUnit_Framework_TestSuite('Zend_Controller_Action_Helper_NamespaceTest');
  47. $result = PHPUnit_TextUI_TestRunner::run($suite);
  48. }
  49. /**
  50. * @group ZF-10158
  51. */
  52. public function testGetNameWithNamespace()
  53. {
  54. if (version_compare(PHP_VERSION, '5.3.0') === -1) {
  55. $this->markTestSkipped('Namespaces not available in PHP < 5.3.0');
  56. }
  57. require_once dirname(__FILE__) . '/../../_files/Helpers/NamespacedHelper.php';
  58. $className = 'MyApp\Controller\Action\Helper\NamespacedHelper';
  59. $helper = new $className;
  60. $this->assertEquals('NamespacedHelper', $helper->getName());
  61. }
  62. }
  63. // Call Zend_Controller_Action_Helper_NamespaceTest::main() if this source file is executed directly.
  64. if (PHPUnit_MAIN_METHOD == 'Zend_Controller_Action_Helper_NamespaceTest::main') {
  65. Zend_Controller_Action_Helper_NamespaceTest::main();
  66. }