public function testDocs() { $middleware = new SessionOnlyAccess(); $sessHeaderMiddleware = new SessionHeader(); $this->setUpApp(array('PATH_INFO' => '/modelbs/4', 'SESSION' => '111444'), array($sessHeaderMiddleware, $middleware)); $identity = new Identity($this->app, new RESTAccess($this->app)); $this->app->addExtension($identity); $this->app->getDocJSON(new MarkdownParser()); $docArray = array(); $rClassMock = $this->getMock('\\ReflectionClass', array(), array(), '', FALSE); $rRefMock = new \ReflectionMethod('\\mabiTesting\\ModelBController', 'post'); $sessHeaderMiddleware->documentMethod($rClassMock, $rRefMock, $docArray); $middleware->documentMethod($rClassMock, $rRefMock, $docArray); $this->assertInternalType('array', $docArray); $this->assertNotEmpty('array', $docArray['parameters']); $this->assertNotCount(0, $docArray['parameters']); $sessionFound = FALSE; foreach ($docArray['parameters'] as $parameterDoc) { if (is_array($parameterDoc) && $parameterDoc['Name'] == 'SESSION' && $parameterDoc['Location'] == 'header') { $this->assertEquals('Y', $parameterDoc['Required']); $sessionFound = TRUE; break; } } $this->assertTrue($sessionFound); }
public function testDocs() { $middleware = new SessionHeader(); $this->setUpApp(array('PATH_INFO' => '/modelbs', 'SESSION' => '111444'), array($middleware)); $identity = new Identity($this->app, new RESTAccess($this->app)); $this->app->addExtension($identity); $docArray = array(); $rClassMock = $this->getMock('\\ReflectionClass', array(), array(), '', FALSE); $rRefMock = $this->getMock('\\ReflectionMethod', array(), array(), '', FALSE); $middleware->documentMethod($rClassMock, $rRefMock, $docArray); $this->assertInternalType('array', $docArray); $this->assertNotEmpty('array', $docArray['parameters']); $this->assertNotCount(0, $docArray['parameters']); $sessionFound = FALSE; foreach ($docArray['parameters'] as $parameterDoc) { if (is_array($parameterDoc) && $parameterDoc['Name'] == 'SESSION' && $parameterDoc['Location'] == 'header') { $sessionFound = TRUE; break; } } $this->assertTrue($sessionFound); }