mirror of
https://github.com/danog/amp.git
synced 2024-12-02 09:27:46 +01:00
24 lines
560 B
PHP
24 lines
560 B
PHP
<?php
|
|
|
|
namespace Amp\Test;
|
|
|
|
use Amp\Success;
|
|
|
|
class SuccessTest extends \PHPUnit_Framework_TestCase {
|
|
|
|
public function testWhenInvokedImmediately() {
|
|
$value = 42;
|
|
$success = new Success($value);
|
|
$success->when(function($error, $result) use ($value) {
|
|
$this->assertNull($error);
|
|
$this->assertSame($value, $result);
|
|
});
|
|
}
|
|
|
|
public function testWaitReturnsResolvedValue() {
|
|
$value = 42;
|
|
$success = new Success($value);
|
|
$this->assertSame($value, $success->wait());
|
|
}
|
|
}
|