mirror of
https://github.com/danog/amp.git
synced 2024-11-30 04:29:08 +01:00
Add test for weak types
This commit is contained in:
parent
a4d572cab9
commit
c49fba263c
19
src/Test.php
19
src/Test.php
@ -211,4 +211,23 @@ abstract class Test extends \PHPUnit_Framework_TestCase {
|
||||
|
||||
$this->assertEquals(4, $invoked);
|
||||
}
|
||||
|
||||
function testWeakTypes() {
|
||||
$invoked = 0;
|
||||
list($promise, $succeeder) = $this->promise();
|
||||
|
||||
$expectedData = "15.24";
|
||||
|
||||
$promise->when(function($e, int $v) use (&$invoked, $expectedData) {
|
||||
$invoked++;
|
||||
$this->assertSame((int) $expectedData, $v);
|
||||
});
|
||||
$succeeder($expectedData);
|
||||
$promise->when(function($e, int $v) use (&$invoked, $expectedData) {
|
||||
$invoked++;
|
||||
$this->assertSame((int) $expectedData, $v);
|
||||
});
|
||||
|
||||
$this->assertEquals(2, $invoked);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user