1
0
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:
Bob Weinand 2016-12-29 18:57:42 +01:00
parent a4d572cab9
commit c49fba263c

View File

@ -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);
}
}