Skip to content

Commit

Permalink
Update CorsMiddlewareTest.php
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasAFink authored Jan 22, 2025
1 parent 97d86f1 commit 986d1a4
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions zmscitizenapi/tests/Zmscitizenapi/Middleware/CorsMiddlewareTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,29 +24,29 @@ class CorsMiddlewareTest extends MiddlewareTestCase
putenv('CORS=http://localhost:8080');
\App::reinitializeMiddlewareConfig();
$this->middleware = new CorsMiddleware($this->logger);
}
}*/

protected function tearDown(): void
/*protected function tearDown(): void
{
putenv('CORS'); // Clear environment variable
parent::tearDown();
}
}*/

public function testAllowsRequestWithoutOrigin(): void
/*public function testAllowsRequestWithoutOrigin(): void
{
$request = $this->createRequest();
$response = new Response();
$handler = $this->createHandler($response);
$handler = $this->createHandler($response);*/

/*$this->logger->expectLogInfo('Direct browser request - no Origin header', [
'uri' => 'http://localhost/test'
]);*/

$result = $this->middleware->process($request, $handler);
/*$result = $this->middleware->process($request, $handler);
$this->assertSame($response, $result);
}
}*/

public function testBlocksDisallowedOrigin(): void
/*public function testBlocksDisallowedOrigin(): void
{
$request = $this->createRequest(['Origin' => 'http://evil.com']);
$response = new Response();
Expand All @@ -66,9 +66,9 @@ public function testBlocksDisallowedOrigin(): void
['errors' => [ErrorMessages::get('corsOriginNotAllowed')]],
$logBody
);
}
}*/

public function testAllowsWhitelistedOrigin(): void
/*public function testAllowsWhitelistedOrigin(): void
{
$request = $this->createRequest(['Origin' => 'http://localhost:8080']);
$response = new Response();
Expand All @@ -78,9 +78,9 @@ public function testAllowsWhitelistedOrigin(): void
$this->assertEquals('http://localhost:8080', $result->getHeaderLine('Access-Control-Allow-Origin'));
$this->assertNotEmpty($result->getHeaderLine('Access-Control-Allow-Methods'));
}
}*/

public function testHandlesPreflightRequest(): void
/*public function testHandlesPreflightRequest(): void
{
$headers = new \Slim\Psr7\Headers([
'Origin' => 'http://localhost:8080',
Expand Down

0 comments on commit 986d1a4

Please sign in to comment.