mirror of
https://github.com/retailcrm/graphql-php.git
synced 2025-02-11 10:09:24 +03:00
Enabled subscriptions in executor
This commit is contained in:
parent
31f40f5e26
commit
26db43e7c4
@ -196,9 +196,18 @@ class Executor
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
return $mutationType;
|
return $mutationType;
|
||||||
|
case 'subscription':
|
||||||
|
$subscriptionType = $schema->getSubscriptionType();
|
||||||
|
if (!$subscriptionType) {
|
||||||
|
throw new Error(
|
||||||
|
'Schema is not configured for subscriptions',
|
||||||
|
[ $operation ]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return $subscriptionType;
|
||||||
default:
|
default:
|
||||||
throw new Error(
|
throw new Error(
|
||||||
'Can only execute queries and mutations',
|
'Can only execute queries, mutations and subscriptions',
|
||||||
[$operation]
|
[$operation]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -218,10 +218,8 @@ class EnumTypeTest extends \PHPUnit_Framework_TestCase
|
|||||||
*/
|
*/
|
||||||
public function testAcceptsEnumLiteralsAsInputArgumentsToSubscriptions()
|
public function testAcceptsEnumLiteralsAsInputArgumentsToSubscriptions()
|
||||||
{
|
{
|
||||||
$this->markTestIncomplete('Enable when subscription support is implemented');
|
|
||||||
|
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
['data' => ['subscribeToEnum' => 'GREEN'], 'errors' => [[]]],
|
['data' => ['subscribeToEnum' => 'GREEN']],
|
||||||
GraphQL::execute(
|
GraphQL::execute(
|
||||||
$this->schema,
|
$this->schema,
|
||||||
'subscription x($color: Color!) { subscribeToEnum(color: $color) }',
|
'subscription x($color: Color!) { subscribeToEnum(color: $color) }',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user