This repository has been archived by the owner on Nov 20, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #98 from govCMS/feature/nginx-testing
[GOVCMSD7-276] Add BDD/Unit testing for nginx configuration.
- Loading branch information
Showing
24 changed files
with
1,984 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
.../images/nginx/helpers/acsf_redirects.conf → ...ges/nginx/helpers/202-acsf_redirects.conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
### | ||
### Add the X-Robots-Tag to the server response | ||
### @see https://developers.google.com/search/reference/robots_meta_tag | ||
### | ||
|
||
# All is default and essentially has no effect. | ||
set $robots_header "all"; | ||
|
||
if ($host ~* ^(?!www\.govcms\.gov\.au$)(?:[\w\-]+\.)+govcms\.gov\.au$){ | ||
# None = noindex, nofollow. | ||
set $robots_header "none"; | ||
} | ||
|
||
add_header X-Robots-Tag $robots_header; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
vendor/ | ||
.phpunit* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<?php | ||
|
||
/** | ||
* PHPUnit Bootstrap file. | ||
*/ | ||
|
||
include_once __DIR__ . '/vendor/autoload.php'; | ||
|
||
function get_curl_headers($path = "/", $opts = NULL) { | ||
$uri = getenv('LOCALDEV_URL') ?: 'http://nginx:8080'; | ||
|
||
$response = null; | ||
|
||
$path = '/' . ltrim($path, '/'); | ||
|
||
exec("docker-compose exec -T test curl {$uri}{$path} -I {$opts} 2>/dev/null", $response); | ||
|
||
if (empty($response)) { | ||
return []; | ||
} | ||
|
||
$response = array_map('trim', $response); | ||
|
||
foreach ($response as $line) { | ||
if (strpos($line, 'HTTP') !== false) { | ||
$part = explode(' ', $line); | ||
$headers['Status'] = trim($part[1]); | ||
continue; | ||
} | ||
$part = explode(':', $line); | ||
if (count($part) == 2) { | ||
$headers[$part[0]] = trim($part[1]); | ||
} | ||
} | ||
|
||
return $headers; | ||
} | ||
|
||
function curl_get_content($path = "/", $opts = NULL) { | ||
$uri = getenv('LOCALDEV_URL') ?: 'http://nginx:8080'; | ||
|
||
$response = null; | ||
$path = '/' . ltrim($path, '/'); | ||
|
||
exec("docker-compose exec -T test curl {$uri}{$path} {$opts} 2>/dev/null", $response); | ||
|
||
if (empty($response)) { | ||
return FALSE; | ||
} | ||
|
||
return $response; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"name": "govcmstests/nginx", | ||
"description": "Testing framework for the nginx image.", | ||
"type": "project", | ||
"authors": [ | ||
{ | ||
"name": "Steve Worley", | ||
"email": "[email protected]" | ||
} | ||
], | ||
"require": { | ||
"phpunit/phpunit": "^7.5" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"GovCMSTests\\": "src/" | ||
} | ||
} | ||
} |
Oops, something went wrong.