Skip to content

Commit

Permalink
Circle CI code style
Browse files Browse the repository at this point in the history
  • Loading branch information
jn-jairo committed Mar 8, 2022
1 parent 70d806a commit b12f664
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 7 deletions.
31 changes: 31 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ jobs:
docker:
- image: cimg/php:<< parameters.php_version >>

resource_class: small

steps:
- checkout

Expand All @@ -31,6 +33,33 @@ jobs:

- run: ./vendor/bin/phpunit

code-style:
docker:
- image: cimg/php:8.1

resource_class: small

steps:
- checkout

- restore_cache:
keys:
- composer-v1-{{ .Branch }}-{{ checksum "composer.json" }}
- composer-v1-{{ .Branch }}-

- run: sudo composer self-update --2

- run: composer global require "squizlabs/php_codesniffer"

- run: composer global update -n --prefer-dist --prefer-stable

- save_cache:
key: composer-v1-{{ .Branch }}-{{ checksum "composer.json" }}
paths:
- ~/.cache/composer

- run: phpcs -n src/ tests/

workflows:
workflow:
jobs:
Expand All @@ -40,4 +69,6 @@ workflows:
parameters:
php_version: ["7.3", "7.4", "8.0", "8.1"]
dependency: ["stable"]
- code-style:
name: code-style

6 changes: 4 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
"orchestra/testbench": "^4.0|^5.0|^6.0|^7.0",
"phpspec/prophecy": "^1.15",
"phpspec/prophecy-phpunit": "^2.0",
"phpunit/phpunit": "^9.5"
"phpunit/phpunit": "^9.5",
"squizlabs/php_codesniffer": "^3.6"
},
"autoload": {
"psr-4": {
Expand All @@ -42,7 +43,8 @@
"scripts": {
"test": "vendor/bin/phpunit",
"test-coverage": "XDEBUG_MODE=coverage vendor/bin/phpunit",
"test-stable": "for version in 7.3 7.4 8.0 8.1 ; do if command -v php${version} > /dev/null 2>&1 ; then echo '\nPHP: '${version}'\n' && php${version} $(which composer) update --prefer-dist --no-interaction --prefer-stable > /dev/null 2>&1 && php${version} vendor/bin/phpunit ; fi ; done"
"test-stable": "for version in 7.3 7.4 8.0 8.1 ; do if command -v php${version} > /dev/null 2>&1 ; then echo '\nPHP: '${version}'\n' && php${version} $(which composer) update --prefer-dist --no-interaction --prefer-stable > /dev/null 2>&1 && php${version} vendor/bin/phpunit ; fi ; done",
"code-style": "vendor/bin/phpcs -n src/ tests/"
},
"config": {
"sort-packages": true
Expand Down
20 changes: 16 additions & 4 deletions tests/NgrokCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,10 @@ public function test_handle() : void
$process->getExitCode()->willReturn(0)->shouldBeCalled();

$processBuilder = $this->prophesize(NgrokProcessBuilder::class);
$processBuilder->buildProcess($hostHeader, $port, $host, $extra)->willReturn($process->reveal())->shouldBeCalled();
$processBuilder
->buildProcess($hostHeader, $port, $host, $extra)
->willReturn($process->reveal())
->shouldBeCalled();

app()->instance(NgrokWebService::class, $webService->reveal());
app()->instance(NgrokProcessBuilder::class, $processBuilder->reveal());
Expand Down Expand Up @@ -118,7 +121,10 @@ public function test_handle_extra() : void
$process->getExitCode()->willReturn(0)->shouldBeCalled();

$processBuilder = $this->prophesize(NgrokProcessBuilder::class);
$processBuilder->buildProcess($hostHeader, $port, $host, $extra)->willReturn($process->reveal())->shouldBeCalled();
$processBuilder
->buildProcess($hostHeader, $port, $host, $extra)
->willReturn($process->reveal())
->shouldBeCalled();

app()->instance(NgrokWebService::class, $webService->reveal());
app()->instance(NgrokProcessBuilder::class, $processBuilder->reveal());
Expand Down Expand Up @@ -179,7 +185,10 @@ public function test_handle_from_config() : void
$process->getExitCode()->willReturn(0)->shouldBeCalled();

$processBuilder = $this->prophesize(NgrokProcessBuilder::class);
$processBuilder->buildProcess($hostHeader, $port, $host, $extra)->willReturn($process->reveal())->shouldBeCalled();
$processBuilder
->buildProcess($hostHeader, $port, $host, $extra)
->willReturn($process->reveal())
->shouldBeCalled();

app()->instance(NgrokWebService::class, $webService->reveal());
app()->instance(NgrokProcessBuilder::class, $processBuilder->reveal());
Expand Down Expand Up @@ -221,7 +230,10 @@ public function test_handle_invalid_host_header() : void
$process->getExitCode()->willReturn(0)->shouldNotBeCalled();

$processBuilder = $this->prophesize(NgrokProcessBuilder::class);
$processBuilder->buildProcess($hostHeader, $port, $host, $extra)->willReturn($process->reveal())->shouldNotBeCalled();
$processBuilder
->buildProcess($hostHeader, $port, $host, $extra)
->willReturn($process->reveal())
->shouldNotBeCalled();

app()->instance(NgrokWebService::class, $webService->reveal());
app()->instance(NgrokProcessBuilder::class, $processBuilder->reveal());
Expand Down
3 changes: 2 additions & 1 deletion tests/NgrokProcessBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ public function buildProcessProvider() : array
],
'extra_multiple' => [
['example.com', '', '', ['--region=eu', '--config=../ngrok.yml']],
'\'ngrok\' \'http\' \'--log\' \'stdout\' \'--region=eu\' \'--config=../ngrok.yml\' \'--host-header\' \'example.com\' \'80\'',
'\'ngrok\' \'http\' \'--log\' \'stdout\' \'--region=eu\''
. ' \'--config=../ngrok.yml\' \'--host-header\' \'example.com\' \'80\'',
],
];
}
Expand Down

0 comments on commit b12f664

Please sign in to comment.