1
0
mirror of https://github.com/danog/amp.git synced 2024-12-12 09:29:45 +01:00
amp/test/PromisorPublicTest.php
2015-07-21 12:25:34 -04:00

36 lines
884 B
PHP

<?php
namespace Amp\Test;
use Amp\Promisor;
use Amp\Test\PromisorPublicImpl;
class PromisorPublicTest extends PromisorTest {
protected function getPromisor() {
return new PromisorPublicImpl;
}
public function testPromiseReturnsSelf() {
$promisor = new PromisorPublicImpl;
$this->assertSame($promisor, $promisor->promise());
}
/**
* @expectedException \InvalidArgumentException
* @expectedExceptionMessage Throwable Exception instance required to fail a promise
* @dataProvider provideBadFailureArguments
*/
public function testResolvingErrorWithNonExceptionThrows($badArg) {
$promisor = $this->getPromisor();
$promisor->fail($badArg);
}
public function provideBadFailureArguments() {
return [
[1],
[true],
[new \StdClass],
];
}
}