1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-06 03:50:04 +02:00
Oinktube/vendor/react/promise/tests/FunctionRejectTest.php
2021-10-05 13:39:35 -03:00

64 lines
1.4 KiB
PHP

<?php
namespace React\Promise;
class FunctionRejectTest extends TestCase
{
/** @test */
public function shouldRejectAnImmediateValue()
{
$expected = 123;
$mock = $this->createCallableMock();
$mock
->expects($this->once())
->method('__invoke')
->with($this->identicalTo($expected));
reject($expected)
->then(
$this->expectCallableNever(),
$mock
);
}
/** @test */
public function shouldRejectAFulfilledPromise()
{
$expected = 123;
$resolved = new FulfilledPromise($expected);
$mock = $this->createCallableMock();
$mock
->expects($this->once())
->method('__invoke')
->with($this->identicalTo($expected));
reject($resolved)
->then(
$this->expectCallableNever(),
$mock
);
}
/** @test */
public function shouldRejectARejectedPromise()
{
$expected = 123;
$resolved = new RejectedPromise($expected);
$mock = $this->createCallableMock();
$mock
->expects($this->once())
->method('__invoke')
->with($this->identicalTo($expected));
reject($resolved)
->then(
$this->expectCallableNever(),
$mock
);
}
}