public function testInvokeArgsMethod()
 {
     $fileNamespace = $this->parsedRefFile->getFileNamespace('Go\\ParserReflection\\Stub');
     $refFunc = $fileNamespace->getFunction('funcWithReturnArgs');
     $retValue = $refFunc->invokeArgs([1, 2, 3]);
     $this->assertEquals([1, 2, 3], $retValue);
 }
 public function testGetGlobalFileNamespace()
 {
     $fileName = stream_resolve_include_path(__DIR__ . self::STUB_GLOBAL_FILE);
     $reflectionFile = new ReflectionFile($fileName);
     $reflectionFileNamespace = $reflectionFile->getFileNamespace('\\');
     $this->assertInstanceOf('Go\\ParserReflection\\ReflectionFileNamespace', $reflectionFileNamespace);
 }
 protected function setUp()
 {
     $this->originalRefClass = $refClass = new \ReflectionClass(self::STUB_CLASS);
     $fileName = $refClass->getFileName();
     $reflectionFile = new ReflectionFile($fileName);
     $parsedClass = $reflectionFile->getFileNamespace($refClass->getNamespaceName())->getClass($refClass->getName());
     $this->parsedRefClass = $parsedClass;
 }
 protected function setUp()
 {
     $fileName = stream_resolve_include_path(__DIR__ . self::STUB_FILE);
     $fileNode = ReflectionEngine::parseFile($fileName);
     $reflectionFile = new ReflectionFile($fileName, $fileNode);
     $parsedFileNamespace = $reflectionFile->getFileNamespace('Go\\ParserReflection\\Stub');
     $this->parsedRefFileNamespace = $parsedFileNamespace;
     include_once $fileName;
 }
 /**
  * @dataProvider listOfDefaultGetters
  *
  * @param string $getterName Name of the getter to call
  */
 public function testGetDefaultValueThrowsAnException($getterName)
 {
     $originalException = null;
     $parsedException = null;
     try {
         $originalRefParameter = new \ReflectionParameter('Go\\ParserReflection\\Stub\\miscParameters', 'arrayParam');
         $originalRefParameter->{$getterName}();
     } catch (\ReflectionException $e) {
         $originalException = $e;
     }
     try {
         $parsedNamespace = $this->parsedRefFile->getFileNamespace('Go\\ParserReflection\\Stub');
         $parsedFunction = $parsedNamespace->getFunction('miscParameters');
         $parsedRefParameters = $parsedFunction->getParameters();
         $parsedRefParameter = $parsedRefParameters[0];
         $parsedRefParameter->{$getterName}();
     } catch (\ReflectionException $e) {
         $parsedException = $e;
     }
     $this->assertInstanceOf('ReflectionException', $originalException);
     $this->assertInstanceOf('ReflectionException', $parsedException);
     $this->assertSame($originalException->getMessage(), $parsedException->getMessage());
 }
 /**
  * Tests specific features of PHP5.6 and newer, for example, array constants, etc
  */
 public function testGettersPHP56()
 {
     if (PHP_VERSION_ID < 50600) {
         $this->markTestSkipped("Can not test new features on old version of PHP");
     }
     $fileName = stream_resolve_include_path(__DIR__ . self::STUB_FILE56);
     $fileNode = ReflectionEngine::parseFile($fileName);
     $reflectionFile = new ReflectionFile($fileName, $fileNode);
     include_once $fileName;
     $parsedFileNamespace = $reflectionFile->getFileNamespace('Go\\ParserReflection\\Stub');
     foreach ($parsedFileNamespace->getClasses() as $parsedRefClass) {
         $this->performGeneralMethodComparison($parsedRefClass);
     }
 }