mirror of
https://github.com/danog/amp.git
synced 2024-12-12 09:29:45 +01:00
18 lines
422 B
PHP
18 lines
422 B
PHP
<?php
|
|
|
|
namespace Amp\Test;
|
|
|
|
use Amp\Failure;
|
|
|
|
class FailureTest extends \PHPUnit_Framework_TestCase {
|
|
|
|
public function testWhenInvokedImmediately() {
|
|
$exception = new \Exception('test');
|
|
$failure = new Failure($exception);
|
|
$failure->when(function($error, $result) use ($exception) {
|
|
$this->assertNull($result);
|
|
$this->assertSame($exception, $error);
|
|
});
|
|
}
|
|
}
|