Skip to content

Commit

Permalink
Fix Github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
SRWieZ committed Oct 31, 2023
1 parent 52b5d0d commit 0bfc8a0
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
7 changes: 4 additions & 3 deletions tests/Feature/ConvertTest.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?php

test('it fixes all the issues we can fix', function ($svg) {
$this->output_file = 'tmp/'.$svg.'.tinyps';
exec('php src/svgtinyps.php convert assets/'.$svg.' '.$this->output_file, $convert_output, $convert_code);
$this->input_file = fixPathForTest('assets/'.$svg);
$this->output_file = fixPathForTest('tmp/').$svg.'.tinyps';
exec('php src/svgtinyps.php convert '.$this->input_file.' '.$this->output_file, $convert_output, $convert_code);
exec('php src/svgtinyps.php issues '.$this->output_file, $issues_output, $issues_code);
$this->issues_after = array_filter(array_map('trim', $issues_output));

Expand All @@ -24,6 +25,6 @@
unlink($this->output_file);

if ($this->status()->isFailure()) {
dump($this->issues_after);
dump($this->issues_after, $this->input_file, $this->output_file);
}
});
6 changes: 5 additions & 1 deletion tests/Feature/IssuesTest.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
<?php

test('it returns issues', function ($svg, $issues_excepted) {
exec('php src/svgtinyps.php issues assets/'.$svg, $output, $exit_code);
$input_file = fixPathForTest('assets/'.$svg);

exec('php src/svgtinyps.php issues '.$input_file, $output, $exit_code);
$issues = array_filter(array_map('trim', $output));

$diff = array_diff(array_unique($issues), array_unique($issues_excepted));
$diff2 = array_diff(array_unique($issues_excepted), array_unique($issues));

expect($diff)->toBeEmpty()
->and($diff2)->toBeEmpty()
->and($exit_code)->toBe(0);
})->with('logos');
5 changes: 5 additions & 0 deletions tests/Pest.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,8 @@
| global functions to help you to reduce the number of lines of code in your test files.
|
*/

function fixPathForTest($path)
{
return realpath(__DIR__.'/../'.$path);
}

0 comments on commit 0bfc8a0

Please sign in to comment.