This repository has been archived by the owner on Mar 27, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Erin Millard
committed
Jul 2, 2012
1 parent
989ec90
commit 0f82378
Showing
2 changed files
with
59 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Asplode package. | ||
* | ||
* Copyright © 2012 Erin Millard | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
class FunctionalTest extends \Eloquent\Asplode\Test\TestCase | ||
{ | ||
/** | ||
* Test one line installation. | ||
*/ | ||
public function testOneLineInstallation() | ||
{ | ||
\Eloquent\Asplode\Asplode::instance()->install(); | ||
$actual = set_error_handler(function() {}); | ||
restore_error_handler(); | ||
restore_error_handler(); | ||
|
||
$this->assertTrue(is_array($actual)); | ||
$this->assertSame(array(0, 1), array_keys($actual)); | ||
$this->assertInstanceOf('Eloquent\Asplode\Asplode', $actual[0]); | ||
$this->assertSame('handleError', $actual[1]); | ||
$this->assertTrue(is_callable($actual)); | ||
} | ||
|
||
/** | ||
* Test legacy PHP error example. | ||
*/ | ||
public function testLegacyPhpError() | ||
{ | ||
$this->setExpectedException('PHPUnit_Framework_Error_Warning'); | ||
$fp = fopen(uniqid(), 'r'); | ||
} | ||
|
||
/** | ||
* Test Asplode error handling. | ||
*/ | ||
public function testAsplodeHandling() | ||
{ | ||
\Eloquent\Asplode\Asplode::instance()->install(); | ||
$caught = false; | ||
try | ||
{ | ||
$fp = fopen(uniqid(), 'r'); | ||
} | ||
catch (ErrorException $e) | ||
{ | ||
$caught = true; | ||
} | ||
|
||
$this->assertTrue($caught); | ||
} | ||
} |