Skip to content

Commit

Permalink
add separate test suite for mock tests
Browse files Browse the repository at this point in the history
  • Loading branch information
flotzilla committed Apr 13, 2020
1 parent 43cfb5c commit c9f2a99
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 5 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
composer.lock
vendor
phpunit.xml
5 changes: 4 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@
},
"scripts": {
"test": [
"phpunit"
"phpunit --configuration phpunit.xml --testsuite tests"
],
"test_mock": [
"phpunit --configuration phpunit.xml --testsuite mock"
],
"stan": [
"vendor/bin/phpstan analyse -l 4 -c phpstan.neon.dist src"
Expand Down
6 changes: 5 additions & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,12 @@
processIsolation="false"
stopOnFailure="false">
<testsuites>
<testsuite name="Container tests">
<testsuite name="tests">
<directory>./tests</directory>
<exclude>./tests/MockFormatter/</exclude>
</testsuite>
<testsuite name="mock">
<file>./tests/MockFormatter</file>
</testsuite>
</testsuites>
<filter>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ function json_encode()
}
}

namespace flotzilla\Logger\Test\Formatter {
namespace flotzilla\Logger\Test\MockFormatter {

use flotzilla\Logger\Exception\FormatterException;
use flotzilla\Logger\Formatter\JsonFormatter;
Expand All @@ -26,13 +26,14 @@ protected function setUp()
{
$this->formatter = new JsonFormatter();
}

public function testException()
{
$this->expectException(FormatterException::class);
$this->expectException(FormatterException::class);

$date = date('Y-m-d H:i:s');

$this->formatter->format('some str', ['data' => ['dd' => 123]]);
}
}
}
}

0 comments on commit c9f2a99

Please sign in to comment.