mirror of
https://github.com/retailcrm/graphql-php.git
synced 2025-02-16 12:23:15 +03:00
Extract anonymous class
This commit is contained in:
parent
e07c86bd5e
commit
8a5f337469
@ -69,14 +69,7 @@ class ResolveTest extends \PHPUnit_Framework_TestCase
|
||||
$_secret = 'secretValue' . uniqid();
|
||||
|
||||
$source = [
|
||||
'test' => new class($_secret) {
|
||||
public function __construct($_secret) {
|
||||
$this->_secret = $_secret;
|
||||
}
|
||||
public function __invoke() {
|
||||
return $this->_secret;
|
||||
}
|
||||
}
|
||||
'test' => new ResolveTestCallableFixture($_secret)
|
||||
];
|
||||
$this->assertEquals(
|
||||
['data' => ['test' => $_secret]],
|
||||
@ -139,3 +132,18 @@ class ResolveTest extends \PHPUnit_Framework_TestCase
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class ResolveTestCallableFixture
|
||||
{
|
||||
private $value;
|
||||
|
||||
public function __construct($value)
|
||||
{
|
||||
$this->value = $value;
|
||||
}
|
||||
|
||||
public function __invoke($root, $args, $context)
|
||||
{
|
||||
return $this->value;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user