Skip to content

Commit

Permalink
Add header tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Brunty committed Dec 5, 2018
1 parent c670458 commit 5892eca
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 1 deletion.
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
}
},
"require": {
"php": ">=7.0"
"php": ">=7.0",
"ext-json": "*"
},
"require-dev": {
"symfony/process": "^3.3",
Expand Down
14 changes: 14 additions & 0 deletions spec/CigarCliSpec.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,18 @@

expect($process->getExitCode())->toBe(0);
});

it('can be passed headers as full arguments', function () {
$process = new Process('cd spec && cp stubs/.cigar.headers.json .cigar.json && ../bin/cigar --header="X-Cigar-Header: some-header-content-here" --header="X-Cigar-Header-2: more-header-content-here"');
$process->run();

expect($process->getExitCode())->toBe(0);
});

it('can be passed headers as short arguments', function () {
$process = new Process('cd spec && cp stubs/.cigar.headers.json .cigar.json && ../bin/cigar -h "X-Cigar-Header: some-header-content-here" -h "X-Cigar-Header-2: more-header-content-here"');
$process->run();

expect($process->getExitCode())->toBe(0);
});
});
12 changes: 12 additions & 0 deletions spec/stubs/.cigar.headers.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[
{
"url": "http://httpbin.org/headers",
"status": 200,
"content": "some-header-content-here"
},
{
"url": "http://httpbin.org/headers",
"status": 200,
"content": "more-header-content-here"
}
]

0 comments on commit 5892eca

Please sign in to comment.