Skip to content
This repository has been archived by the owner on Apr 3, 2022. It is now read-only.

Commit

Permalink
[REPEKA-140] Fail tests when there are warnings
Browse files Browse the repository at this point in the history
sebastianbergmann/phpunit#2246

Change-Id: I8a61ed18fcbf847f65ae0f56969e477a8760e8a9
  • Loading branch information
fracz committed Mar 3, 2017
1 parent 924c45c commit 841c055
Show file tree
Hide file tree
Showing 6 changed files with 80 additions and 65 deletions.
123 changes: 64 additions & 59 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Expand Up @@ -39,9 +39,9 @@
"test": "npm run -s test:backend && npm run -s test:admin",
"test:admin": "cd src/AdminPanel && npm test -s",
"test:backend": "npm run -s test:backend:unit && npm run -s test:backend:integration",
"test:backend:unit": "sh -c \"vendor/bin/phpunit -c scripts/phpunit.xml\"",
"test:backend:integration": "sh -c \"vendor/bin/phpunit -c scripts/phpunit_integration.xml\"",
"test:backend:junit": "sh -c \"vendor/bin/phpunit -c scripts/phpunit.xml --testdox --log-junit var/reports/tests/phpunit.xml --coverage-clover var/reports/coverage/phpunit.xml && vendor/bin/phpunit -c scripts/phpunit_integration.xml --testdox --log-junit var/reports/tests/phpunit_integration.xml\"",
"test:backend:unit": "sh -c \"vendor/bin/phpunit -c scripts --fail-on-warning\"",
"test:backend:integration": "sh -c \"vendor/bin/phpunit -c scripts/phpunit_integration.xml --fail-on-warning\"",
"test:backend:junit": "sh -c \"vendor/bin/phpunit -c scripts --fail-on-warning --testdox --log-junit var/reports/tests/phpunit.xml --coverage-clover var/reports/coverage/phpunit.xml && vendor/bin/phpunit -c scripts/phpunit_integration.xml --fail-on-warning --testdox --log-junit var/reports/tests/phpunit_integration.xml\"",
"test:junit": "rm -f var/reports/tests/*.xml var/reports/coverage/*.xml && npm run -s test:backend:junit && cd src/AdminPanel && npm run -s test:junit",
"watch": "npm run -s clean && cd src/AdminPanel && npm run -s watch"
}
Expand Down
4 changes: 4 additions & 0 deletions scripts/phpunit.xml
Expand Up @@ -5,6 +5,10 @@
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.8/phpunit.xsd"
backupGlobals="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
strict="true"
bootstrap="../app/autoload.php">
<php>
<ini name="error_reporting" value="-1"/>
Expand Down
4 changes: 4 additions & 0 deletions scripts/phpunit_integration.xml
Expand Up @@ -5,6 +5,10 @@
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.8/phpunit.xsd"
backupGlobals="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
strict="true"
bootstrap="../app/integration_tests_bootstrapper.php">
<php>
<ini name="error_reporting" value="-1"/>
Expand Down
3 changes: 2 additions & 1 deletion src/Repeka/Tests/Domain/Entity/ResourceWorkflowTest.php
Expand Up @@ -86,7 +86,8 @@ public function testApplyingTransition() {

public function testMovingToState() {
$this->workflow->setWorkflowStrategy($this->workflowStrategy);
$this->workflowStrategy->expects($this->once())->method('move')->with($this->resource, ['thestate'])->willReturnArgument(0);
$this->workflowStrategy->expects($this->once())->method('setCurrentPlaces')
->with($this->resource, ['thestate'])->willReturnArgument(0);
$this->workflow->setCurrentPlaces($this->resource, ['thestate']);
}

Expand Down
Expand Up @@ -27,7 +27,7 @@ public function testHandlingSimpleWorkflow() {
[new ResourceWorkflowTransition([], [], [], 'transition')]
);
$this->workflowStrategy->expects($this->never())->method('apply');
$this->workflowStrategy->expects($this->once())->method('move')->with($this->isInstanceOf(ResourceEntity::class), []);
$this->workflowStrategy->expects($this->once())->method('setCurrentPlaces')->with($this->isInstanceOf(ResourceEntity::class), []);
$result = $this->handler->handle($command);
$this->assertCount(2, $result);
$this->assertCount(1, $result['places']);
Expand All @@ -37,7 +37,8 @@ public function testHandlingSimpleWorkflow() {
public function testMovingToDesiredCurrentPlace() {
$command = new ResourceWorkflowSimulateCommand([], [], ['current']);
$this->workflowStrategy->expects($this->never())->method('apply');
$this->workflowStrategy->expects($this->once())->method('move')->with($this->isInstanceOf(ResourceEntity::class), ['current']);
$this->workflowStrategy->expects($this->once())->method('setCurrentPlaces')
->with($this->isInstanceOf(ResourceEntity::class), ['current']);
$this->handler->handle($command);
}

Expand Down

0 comments on commit 841c055

Please sign in to comment.