Skip to content

Commit 82caad1

Browse files
committed
fix(test): fail on php errors
1 parent 46a8d60 commit 82caad1

File tree

5 files changed

+24
-8
lines changed

5 files changed

+24
-8
lines changed

docker-compose.yml

+6
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ services:
2828
{
2929
echo 'pdo_mysql.default_socket = /var/run/mysqld/mysql.sock'
3030
echo 'memory_limit = -1'
31+
echo 'error_reporting = '`
32+
php -r 'echo (E_ALL | E_STRICT) ^ E_USER_DEPRECATED ^ E_DEPRECATED ^ E_STRICT ^ E_USER_NOTICE ^ E_NOTICE;'
33+
`
3134
echo 'short_open_tag = off'
3235
echo 'magic_quotes_gpc = off'
3336
echo 'date.timezone = "UTC"'
@@ -57,6 +60,9 @@ services:
5760
{
5861
echo 'pdo_mysql.default_socket = /var/run/mysqld/mysql.sock'
5962
echo 'memory_limit = -1'
63+
echo 'error_reporting = '`
64+
php -r 'echo (E_ALL | E_STRICT) ^ E_USER_DEPRECATED ^ E_DEPRECATED ^ E_STRICT ^ E_USER_NOTICE ^ E_NOTICE;'
65+
`
6066
echo 'short_open_tag = off'
6167
echo 'magic_quotes_gpc = off'
6268
echo 'date.timezone = "UTC"'

lib/vendor/lime/lime.php

+14-2
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function __construct($plan = null, $options = array())
4242
'force_colors' => false,
4343
'output' => null,
4444
'verbose' => false,
45-
'error_reporting' => false,
45+
'error_reporting' => true,
4646
), $options);
4747

4848
$this->output = $this->options['output'] ? $this->options['output'] : new lime_output($this->options['force_colors']);
@@ -140,6 +140,7 @@ public function __destruct()
140140
$plan = $this->results['stats']['plan'];
141141
$passed = count($this->results['stats']['passed']);
142142
$failed = count($this->results['stats']['failed']);
143+
$errors = count($this->results['stats']['errors']);
143144
$total = $this->results['stats']['total'];
144145
is_null($plan) and $plan = $total and $this->output->echoln(sprintf("1..%d", $plan));
145146

@@ -156,6 +157,10 @@ public function __destruct()
156157
{
157158
$this->output->red_bar(sprintf("# Looks like you failed %d tests of %d.", $failed, $passed + $failed));
158159
}
160+
else if ($errors)
161+
{
162+
$this->output->red_bar(sprintf("# Looks like test pass but with %d errors.", $errors));
163+
}
159164
else if ($total == $plan)
160165
{
161166
$this->output->green_bar("# Looks like everything went fine.");
@@ -174,10 +179,11 @@ private function getExitCode()
174179
{
175180
$plan = $this->results['stats']['plan'];
176181
$failed = count($this->results['stats']['failed']);
182+
$errors = count($this->results['stats']['errors']);
177183
$total = $this->results['stats']['total'];
178184
is_null($plan) and $plan = $total and $this->output->echoln(sprintf("1..%d", $plan));
179185

180-
if ($failed)
186+
if ($failed || $errors)
181187
{
182188
return 1;
183189
}
@@ -608,6 +614,12 @@ public function handle_error($code, $message, $file, $line, $context = null)
608614
case E_WARNING:
609615
$type = 'Warning';
610616
break;
617+
case E_STRICT:
618+
$type = 'Strict';
619+
break;
620+
case E_DEPRECATED:
621+
$type = 'Deprecated';
622+
break;
611623
default:
612624
$type = 'Notice';
613625
break;

test/functional/fixtures/apps/cache/config/settings.yml

+2-4
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,15 @@ prod:
55

66
dev:
77
.settings:
8-
# E_ALL | E_STRICT = 4095
9-
error_reporting: 4095
8+
error_reporting: <?php echo (E_ALL | E_STRICT)."\n" ?>
109
web_debug: true
1110
cache: true
1211
no_script_name: false
1312
etag: true
1413

1514
test:
1615
.settings:
17-
# E_ALL | E_STRICT = 4095
18-
error_reporting: 4095
16+
error_reporting: <?php echo ((E_ALL | E_STRICT) ^ E_USER_DEPRECATED ^ E_DEPRECATED ^ E_STRICT ^ E_USER_NOTICE ^ E_NOTICE)."\n" ?>
1917
web_debug: false
2018
cache: true
2119
no_script_name: false

test/functional/fixtures/apps/frontend/config/settings.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ dev:
1313

1414
test:
1515
.settings:
16-
error_reporting: <?php echo ((E_ALL | E_STRICT) ^ E_NOTICE)."\n" ?>
16+
error_reporting: <?php echo ((E_ALL | E_STRICT) ^ E_USER_DEPRECATED ^ E_DEPRECATED ^ E_STRICT ^ E_USER_NOTICE ^ E_NOTICE)."\n" ?>
1717
cache: false
1818
web_debug: false
1919
no_script_name: false

test/functional/fixtures/apps/i18n/config/settings.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ dev:
1313

1414
test:
1515
.settings:
16-
error_reporting: <?php echo ((E_ALL | E_STRICT) ^ E_NOTICE)."\n" ?>
16+
error_reporting: <?php echo ((E_ALL | E_STRICT) ^ E_USER_DEPRECATED ^ E_DEPRECATED ^ E_STRICT ^ E_USER_NOTICE ^ E_NOTICE)."\n" ?>
1717
cache: false
1818
web_debug: false
1919
no_script_name: false

0 commit comments

Comments
 (0)