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

36 lines
884 B
PHP
Raw Normal View History

2014-09-22 22:47:48 +02:00
<?php
2014-09-23 04:38:32 +02:00
namespace Amp\Test;
2014-09-22 22:47:48 +02:00
use Amp\Promisor;
use Amp\Test\PromisorPublicImpl;
2014-09-22 22:47:48 +02:00
class PromisorPublicTest extends PromisorTest {
protected function getPromisor() {
return new PromisorPublicImpl;
2015-03-16 20:04:01 +01:00
}
2014-09-22 22:47:48 +02:00
public function testPromiseReturnsSelf() {
$promisor = new PromisorPublicImpl;
$this->assertSame($promisor, $promisor->promise());
2014-09-22 22:47:48 +02:00
}
2015-07-21 18:25:34 +02:00
/**
* @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],
];
}
2014-09-22 22:47:48 +02:00
}