1
0
mirror of https://github.com/danog/amp.git synced 2024-11-30 04:29:08 +01:00
amp/test/ReactorFactoryTest.php
2014-03-06 09:53:16 -05:00

28 lines
762 B
PHP
Executable File

<?php
namespace Alert;
class ReactorFactoryTest extends \PHPUnit_Framework_TestCase {
public function testSelectReturnsLibeventReactorIfExtensionLoaded() {
if (!extension_loaded('libevent')) {
$this->markTestSkipped(
'ext/libevent extension not loaded'
);
}
$rf = new ReactorFactory;
$reactor = $rf->select();
$this->assertInstanceOf('Alert\LibeventReactor', $reactor);
}
public function testMagicInvokeDelegatesToSelectMethod() {
$rf = $this->getMock('Alert\ReactorFactory', ['select']);
$rf->expects($this->once())
->method('select')
->will($this->returnValue(42));
$this->assertEquals(42, $rf->__invoke());
}
}