PageRenderTime 34ms CodeModel.GetById 10ms RepoModel.GetById 0ms app.codeStats 0ms

/Reflection/tests/extension_test.php

https://github.com/Yannix/zetacomponents
PHP | 119 lines | 72 code | 16 blank | 31 comment | 0 complexity | 35b7cc69012d06dcbea18742a5345da7 MD5 | raw file
  1. <?php
  2. /**
  3. *
  4. * Licensed to the Apache Software Foundation (ASF) under one
  5. * or more contributor license agreements. See the NOTICE file
  6. * distributed with this work for additional information
  7. * regarding copyright ownership. The ASF licenses this file
  8. * to you under the Apache License, Version 2.0 (the
  9. * "License"); you may not use this file except in compliance
  10. * with the License. You may obtain a copy of the License at
  11. *
  12. * http://www.apache.org/licenses/LICENSE-2.0
  13. *
  14. * Unless required by applicable law or agreed to in writing,
  15. * software distributed under the License is distributed on an
  16. * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  17. * KIND, either express or implied. See the License for the
  18. * specific language governing permissions and limitations
  19. * under the License.
  20. *
  21. * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
  22. * @version //autogen//
  23. * @filesource
  24. * @package Reflection
  25. * @subpackage Tests
  26. */
  27. class ezcReflectionExtensionTest extends ezcTestCase
  28. {
  29. /**
  30. * @var ReflectionExtension
  31. */
  32. protected $phpExtRef;
  33. protected $phpExtSpl;
  34. /**
  35. * @var ezcReflectionExtension
  36. */
  37. protected $extRef;
  38. protected $extSpl;
  39. public function setUp() {
  40. $this->phpExtRef = new ReflectionExtension('Reflection');
  41. $this->phpExtSpl = new ReflectionExtension('Spl');
  42. $this->extRef = new ezcReflectionExtension('Reflection');
  43. $this->extSpl = new ezcReflectionExtension('Spl');
  44. }
  45. public function tearDown() {
  46. unset($this->phpExtRef);
  47. unset($this->phpExtSpl);
  48. unset($this->extRef);
  49. unset($this->extSpl);
  50. }
  51. public function testGetFunctions() {
  52. $functs = $this->extRef->getFunctions();
  53. foreach ($functs as $func) {
  54. self::assertInstanceOf('ezcReflectionFunction', $func);
  55. }
  56. self::assertEquals(0, count($functs));
  57. }
  58. public function testGetClasses() {
  59. $classes = $this->extRef->getClasses();
  60. foreach ($classes as $class) {
  61. self::assertInstanceOf('ezcReflectionClass', $class);
  62. }
  63. }
  64. public function testToString() {
  65. self::assertEquals( (string) $this->phpExtRef, (string) $this->extRef);
  66. self::assertEquals( (string) $this->phpExtSpl, (string) $this->extSpl);
  67. }
  68. public function testGetName() {
  69. self::assertEquals('SPL', $this->extSpl->getName());
  70. self::assertEquals('Reflection', $this->extRef->getName());
  71. }
  72. public function testGetVersion() {
  73. $version = $this->extRef->getVersion();
  74. self::assertFalse(empty($version));
  75. }
  76. public function testInfo() {
  77. ob_start();
  78. $this->extRef->info();
  79. $info = ob_get_clean();
  80. self::assertFalse(empty($info));
  81. }
  82. public function testGetConstants() {
  83. $constants = $this->extRef->getConstants();
  84. self::assertTrue(empty($constants));
  85. }
  86. public function testGetINIEntries() {
  87. $iniEntries = $this->extRef->getINIEntries();
  88. self::assertTrue(empty($iniEntries));
  89. }
  90. public function testGetClassNames() {
  91. $classNames = $this->extRef->getClassNames();
  92. self::assertFalse(empty($classNames));
  93. }
  94. public function testGetDependencies() {
  95. self::assertEquals( $this->phpExtRef->getDependencies(), $this->extRef->getDependencies() );
  96. self::assertEquals( $this->phpExtSpl->getDependencies(), $this->extSpl->getDependencies() );
  97. }
  98. public static function suite()
  99. {
  100. return new PHPUnit_Framework_TestSuite( "ezcReflectionExtensionTest" );
  101. }
  102. }
  103. ?>