1
0
mirror of https://github.com/danog/amp.git synced 2024-11-26 20:15:00 +01:00
amp/test/CallableMakerTest.php
Niklas Keller fe88413a17 Upgrade to PHPUnit 6
This commit removes Humbug, as it's no longer maintained and not
compatible with PHPUnit 6.
2017-03-11 14:57:03 +01:00

40 lines
1.1 KiB
PHP

<?php
namespace Amp\Test;
class CallableMaker {
use \Amp\CallableMaker {
callableFromInstanceMethod as public;
callableFromStaticMethod as public;
}
public function instanceMethod() {
return __METHOD__;
}
public static function staticMethod() {
return __METHOD__;
}
}
class CallableMakerTest extends \PHPUnit\Framework\TestCase {
/** @var \Amp\Test\CallableMaker */
private $maker;
public function setUp() {
$this->maker = new CallableMaker;
}
public function testCallableFromInstanceMethod() {
$callable = $this->maker->callableFromInstanceMethod("instanceMethod");
$this->assertInternalType("callable", $callable);
$this->assertSame(\sprintf("%s::%s", CallableMaker::class, "instanceMethod"), $callable());
}
public function testCallableFromStaticMethod() {
$callable = $this->maker->callableFromInstanceMethod("staticMethod");
$this->assertInternalType("callable", $callable);
$this->assertSame(\sprintf("%s::%s", CallableMaker::class, "staticMethod"), $callable());
}
}