mirror of
https://github.com/danog/amp.git
synced 2024-11-27 04:24:42 +01:00
fe88413a17
This commit removes Humbug, as it's no longer maintained and not compatible with PHPUnit 6.
40 lines
1.1 KiB
PHP
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());
|
|
}
|
|
}
|