Skip to content

Commit 3b709a4

Browse files
committed
fixup! fix(test): exit code of lime test
1 parent 8312848 commit 3b709a4

File tree

4 files changed

+30
-2
lines changed

4 files changed

+30
-2
lines changed

lib/vendor/lime/lime.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,10 @@ private function determineAndPrintStateOfTestSuite(): int
161161
return self::STATE_FAIL;
162162
}
163163

164+
if ($this->results['stats']['errors']) {
165+
return self::STATE_FAIL;
166+
}
167+
164168
if (self::STATE_PASS === $planState) {
165169
$this->output->green_bar("# Looks like everything went fine.");
166170
}

test/unit/vendor/lime/fixtures/pass_with_one_error.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
require_once __DIR__.'/../../../../bootstrap/unit.php';
44

5-
error_reporting(-1);
5+
error_reporting(E_USER_ERROR);
66

77
$test = new lime_test(null, [
88
'error_reporting' => true,
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?php
2+
3+
require_once __DIR__.'/../../../../bootstrap/unit.php';
4+
5+
$test = new lime_test();
6+
7+
throw new LogicException('some exception message');
8+
9+
$test->is(true, true);

test/unit/vendor/lime/limeTest.php

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function __construct()
4343
}
4444
}
4545

46-
$test = new lime_test(18);
46+
$test = new lime_test(20);
4747

4848
$files = [
4949
__DIR__.'/fixtures/failed.php',
@@ -113,6 +113,21 @@ public function __construct()
113113
$message = 'with at least one error will fail the overall test suite';
114114
whenExecuteHarnessWithFilesWillHaveResultAndOutput($test, $files, $expectedOverallSucceed, $expectedOutput, $message);
115115

116+
$files = [__DIR__.'/fixtures/pass_with_one_throw_exception.php'];
117+
$expectedOverallSucceed = false;
118+
$expectedOutput = <<<'EOF'
119+
test/unit/vendor/lime/fixtures/pass_with_one_throw_exception.........errors
120+
Errors:
121+
- LogicException: some exception message
122+
Failed Test Stat Total Fail Errors List of Failed
123+
--------------------------------------------------------------------------
124+
/pass_with_one_throw_exception 1 0 0 1
125+
Failed 1/1 test scripts, 0.00% okay. 0/0 subtests failed, 0.00% okay.
126+
127+
EOF;
128+
$message = 'with at least one thrown Exception will fail the overall test suite';
129+
whenExecuteHarnessWithFilesWillHaveResultAndOutput($test, $files, $expectedOverallSucceed, $expectedOutput, $message);
130+
116131

117132
$name = 'pass';
118133
$expectedStatusCode = 0;

0 commit comments

Comments
 (0)