Skip to content

Commit 2270fae

Browse files
committed
fix(test): fail on php errors
1 parent 1fe8979 commit 2270fae

File tree

5 files changed

+22
-7
lines changed

5 files changed

+22
-7
lines changed

Diff for: 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"'

Diff for: lib/vendor/lime/lime.php

+12-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public function __construct($plan = null, $options = array())
3838
'force_colors' => false,
3939
'output' => null,
4040
'verbose' => false,
41-
'error_reporting' => false,
41+
'error_reporting' => true,
4242
), $options);
4343

4444
$this->output = $this->options['output'] ? $this->options['output'] : new lime_output($this->options['force_colors']);
@@ -134,6 +134,7 @@ public function __destruct()
134134
$plan = $this->results['stats']['plan'];
135135
$passed = count($this->results['stats']['passed']);
136136
$failed = count($this->results['stats']['failed']);
137+
$errors = count($this->results['stats']['errors']);
137138
$total = $this->results['stats']['total'];
138139
is_null($plan) and $plan = $total and $this->output->echoln(sprintf("1..%d", $plan));
139140

@@ -150,6 +151,10 @@ public function __destruct()
150151
{
151152
$this->output->red_bar(sprintf("# Looks like you failed %d tests of %d.", $failed, $passed + $failed));
152153
}
154+
else if ($errors)
155+
{
156+
$this->output->red_bar(sprintf("# Looks like test pass but with %d errors.", $errors));
157+
}
153158
else if ($total == $plan)
154159
{
155160
$this->output->green_bar("# Looks like everything went fine.");
@@ -577,6 +582,12 @@ public function handle_error($code, $message, $file, $line, $context = null)
577582
case E_WARNING:
578583
$type = 'Warning';
579584
break;
585+
case E_STRICT:
586+
$type = 'Strict';
587+
break;
588+
case E_DEPRECATED:
589+
$type = 'Deprecated';
590+
break;
580591
default:
581592
$type = 'Notice';
582593
break;

Diff for: 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

Diff for: 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

Diff for: 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)