Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
update docs, minor corrections
  • Loading branch information
geekcom committed Mar 18, 2020
commit 7dfffb77a0c3a2af4a428b96f762856176fd85ea
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,10 @@ With Docker CE and docker-compose installed just run:

To execute tests:

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

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

_Help us writing new tests, make a fork_ :)

Expand Down
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@
},
"scripts": {
"phpcs": "phpcs --standard=PSR12 -n src",
"phpstan": "phpstan analyse src --level 0",
"phpcbf": "phpcbf --standard=PSR12 -n src",
"unit": "phpunit --coverage-clover ./tests/log/clover.xml --colors=always",
"unit-html": "php -d phar.readonly=0 vendor/bin/phpunit --coverage-html ./tests/log/ --colors=always",
"phpstan": "phpstan analyse src --level 0",
"testdox": "phpunit --testdox",
"test": [
"@phpcs",
"@unit",
"@phpstan"
"@phpstan",
"@unit"
]
}
}
6 changes: 3 additions & 3 deletions docs/pt_BR/LEIA-ME_pt_BR.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,10 @@ Com o Docker CE e o docker-compose instalados basta executar os comandos:

Para rodar os testes dentro do container execute:

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

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

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

Expand Down
16 changes: 16 additions & 0 deletions src/PHPJasper.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,18 @@

use PHPJasper\Exception;

use function strtoupper;
use function substr;
use function is_file;
use function realpath;
use function join;
use function array_merge;
use function is_array;
use function in_array;
use function chdir;
use function exec;
use function is_dir;

class PHPJasper
{

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

$this->command .= ' -f ' . join(' ', $options['format']);

if ($options['params']) {
$this->command .= ' -P ';
foreach ($options['params'] as $key => $value) {
Expand Down Expand Up @@ -189,6 +202,7 @@ protected function validateFormat($format)
if (!is_array($format)) {
$format = [$format];
}

foreach ($format as $value) {
if (!in_array($value, $this->formats)) {
throw new Exception\InvalidFormat();
Expand Down Expand Up @@ -231,6 +245,7 @@ public function execute($user = false)

chdir($this->pathExecutable);
exec($this->command, $output, $returnVar);

if ($returnVar !== 0) {
throw new Exception\ErrorCommandExecutable();
}
Expand Down Expand Up @@ -275,6 +290,7 @@ protected function validateExecute()
if (!$this->command) {
throw new Exception\InvalidCommandExecutable();
}

if (!is_dir($this->pathExecutable)) {
throw new Exception\InvalidResourceDirectory();
}
Expand Down
1 change: 1 addition & 0 deletions tests/PHPJasperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

/**
* @author Rafael Queiroz <[email protected]>
* @author Daniel Rodrigues <[email protected]>
*/
final class PHPJasperTest extends TestCase
{
Expand Down