mirror of
https://github.com/retailcrm/graphql-php.git
synced 2025-02-19 22:03:13 +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();
|
$_secret = 'secretValue' . uniqid();
|
||||||
|
|
||||||
$source = [
|
$source = [
|
||||||
'test' => new class($_secret) {
|
'test' => new ResolveTestCallableFixture($_secret)
|
||||||
public function __construct($_secret) {
|
|
||||||
$this->_secret = $_secret;
|
|
||||||
}
|
|
||||||
public function __invoke() {
|
|
||||||
return $this->_secret;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
];
|
];
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
['data' => ['test' => $_secret]],
|
['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