1
0
mirror of https://github.com/danog/amp.git synced 2025-01-10 23:18:20 +01:00
amp/test/unit/ReactorFactoryTest.php

29 lines
756 B
PHP
Raw Normal View History

2013-08-05 22:05:08 +02:00
<?php
use Alert\ReactorFactory;
class ReactorFactoryTest extends PHPUnit_Framework_TestCase {
function testSelectReturnsLibeventReactorIfExtensionLoaded() {
if (!extension_loaded('libevent')) {
$this->markTestSkipped(
'libevent extension not available'
);
}
$rf = new ReactorFactory;
$reactor = $rf->select();
$this->assertInstanceOf('Alert\LibeventReactor', $reactor);
}
function testMagicInvokeDelegatesToSelectMethod() {
$rf = $this->getMock('Alert\ReactorFactory', ['select']);
$rf->expects($this->once())
->method('select')
->will($this->returnValue(42));
$this->assertEquals(42, $rf->__invoke());
}
}