Skip to content

Commit 59409a8

Browse files
committed
Adding a new test suite for the external errors
1 parent 299f159 commit 59409a8

3 files changed

Lines changed: 34 additions & 17 deletions

File tree

phpunit.xml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,12 @@
1515
timeoutForLargeTests="60"
1616
bootstrap="./tests/bootstrap.php">
1717
<testsuites>
18-
<testsuite name="PHP-Rocks :: Core">
18+
<testsuite name="core">
1919
<directory>./tests/PHPRocks</directory>
2020
</testsuite>
21+
<testsuite name="error">
22+
<directory>./tests/errors</directory>
23+
</testsuite>
2124
</testsuites>
2225

2326
<php>

tests/PHPRocks/ErrorHandlerTest.php

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -64,20 +64,4 @@ public function testUndoErrorHandler(){
6464
}
6565
}
6666

67-
public function testFatalError()
68-
{
69-
$error = 'PHPRocks trapped: Allowed memory size of 262144 bytes exhausted (tried to allocate ';
70-
$this->assertContains($error, shell_exec('php tests/fixtures/fatal-error.php'));
71-
}
72-
73-
public function testUndoFatalError()
74-
{
75-
$this->assertSame(null, shell_exec('php tests/fixtures/undo-fatal-error.php'));
76-
}
77-
78-
public function testException()
79-
{
80-
$this->assertSame('random exception', shell_exec('php tests/fixtures/exception-error.php'));
81-
}
82-
8367
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
namespace PHPRocks\Test;
3+
use PHPRocks\ErrorHandler;
4+
5+
/**
6+
* PHP Rocks :: Fat Free Framework
7+
* @author: Daniel Aranda (https://github.com/daniel-aranda/)
8+
*
9+
*/
10+
11+
class ErrorHandlerExternalTest extends Base
12+
{
13+
14+
public function testFatalError()
15+
{
16+
$error = 'PHPRocks trapped: Allowed memory size of 262144 bytes exhausted (tried to allocate ';
17+
$this->assertContains($error, shell_exec('php tests/fixtures/fatal-error.php'));
18+
}
19+
20+
public function testUndoFatalError()
21+
{
22+
$this->assertSame(null, shell_exec('php tests/fixtures/undo-fatal-error.php'));
23+
}
24+
25+
public function testException()
26+
{
27+
$this->assertSame('random exception', shell_exec('php tests/fixtures/exception-error.php'));
28+
}
29+
30+
}

0 commit comments

Comments
 (0)