Skip to content

Commit df25051

Browse files
authored
Merge pull request #212 from PHPJasper/develop
update docs, minor corrections
2 parents 966a4a8 + 7dfffb7 commit df25051

File tree

5 files changed

+27
-10
lines changed

5 files changed

+27
-10
lines changed

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,10 @@ With Docker CE and docker-compose installed just run:
9494

9595
To execute tests:
9696

97-
* `docker exec -it phpjasper ./vendor/bin/phpunit` or
98-
* `docker exec -it phpjasper ./vendor/bin/phpunit --testdox`
97+
* `docker exec -it phpjasper sudo composer test` or
98+
* `docker exec -it phpjasper sudo composer testdox`
9999

100-
To see coverage of tests execute the file: `tests/logs/coverage/index.html`
100+
To see coverage manually of tests, execute the file: `tests/log/report/index.html`
101101

102102
_Help us writing new tests, make a fork_ :)
103103

composer.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,14 @@
3636
},
3737
"scripts": {
3838
"phpcs": "phpcs --standard=PSR12 -n src",
39+
"phpstan": "phpstan analyse src --level 0",
3940
"phpcbf": "phpcbf --standard=PSR12 -n src",
4041
"unit": "phpunit --coverage-clover ./tests/log/clover.xml --colors=always",
41-
"unit-html": "php -d phar.readonly=0 vendor/bin/phpunit --coverage-html ./tests/log/ --colors=always",
42-
"phpstan": "phpstan analyse src --level 0",
42+
"testdox": "phpunit --testdox",
4343
"test": [
4444
"@phpcs",
45-
"@unit",
46-
"@phpstan"
45+
"@phpstan",
46+
"@unit"
4747
]
4848
}
4949
}

docs/pt_BR/LEIA-ME_pt_BR.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,10 @@ Com o Docker CE e o docker-compose instalados basta executar os comandos:
9191

9292
Para rodar os testes dentro do container execute:
9393

94-
* `docker exec -it phpjasper ./vendor/bin/phpunit` ou
95-
* `docker exec -it phpjasper ./vendor/bin/phpunit --testdox`
94+
* `docker exec -it phpjasper sudo composer test` ou
95+
* `docker exec -it phpjasper sudo composer testdox`
9696

97-
Para ver o coverage basta executar o arquivo: `tests/logs/coverage/index.html`
97+
Para ver o coverage basta executar o arquivo: `tests/log/report/index.html`
9898

9999
_Ajude-nos escrevendo novos testes, faça um fork_ :)
100100

src/PHPJasper.php

+16
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,18 @@
1515

1616
use PHPJasper\Exception;
1717

18+
use function strtoupper;
19+
use function substr;
20+
use function is_file;
21+
use function realpath;
22+
use function join;
23+
use function array_merge;
24+
use function is_array;
25+
use function in_array;
26+
use function chdir;
27+
use function exec;
28+
use function is_dir;
29+
1830
class PHPJasper
1931
{
2032

@@ -127,6 +139,7 @@ public function process(string $input, string $output, array $options = [])
127139
$this->command .= ' -o ' . "\"$output\"";
128140

129141
$this->command .= ' -f ' . join(' ', $options['format']);
142+
130143
if ($options['params']) {
131144
$this->command .= ' -P ';
132145
foreach ($options['params'] as $key => $value) {
@@ -189,6 +202,7 @@ protected function validateFormat($format)
189202
if (!is_array($format)) {
190203
$format = [$format];
191204
}
205+
192206
foreach ($format as $value) {
193207
if (!in_array($value, $this->formats)) {
194208
throw new Exception\InvalidFormat();
@@ -231,6 +245,7 @@ public function execute($user = false)
231245

232246
chdir($this->pathExecutable);
233247
exec($this->command, $output, $returnVar);
248+
234249
if ($returnVar !== 0) {
235250
throw new Exception\ErrorCommandExecutable();
236251
}
@@ -275,6 +290,7 @@ protected function validateExecute()
275290
if (!$this->command) {
276291
throw new Exception\InvalidCommandExecutable();
277292
}
293+
278294
if (!is_dir($this->pathExecutable)) {
279295
throw new Exception\InvalidResourceDirectory();
280296
}

tests/PHPJasperTest.php

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
/**
2222
* @author Rafael Queiroz <[email protected]>
23+
* @author Daniel Rodrigues <[email protected]>
2324
*/
2425
final class PHPJasperTest extends TestCase
2526
{

0 commit comments

Comments
 (0)