Enabled subscriptions in executor

This commit is contained in:
vladar 2016-05-02 04:09:40 +06:00
parent 31f40f5e26
commit 26db43e7c4
2 changed files with 11 additions and 4 deletions

View File

@ -196,9 +196,18 @@ class Executor
);
}
return $mutationType;
case 'subscription':
$subscriptionType = $schema->getSubscriptionType();
if (!$subscriptionType) {
throw new Error(
'Schema is not configured for subscriptions',
[ $operation ]
);
}
return $subscriptionType;
default:
throw new Error(
'Can only execute queries and mutations',
'Can only execute queries, mutations and subscriptions',
[$operation]
);
}

View File

@ -218,10 +218,8 @@ class EnumTypeTest extends \PHPUnit_Framework_TestCase
*/
public function testAcceptsEnumLiteralsAsInputArgumentsToSubscriptions()
{
$this->markTestIncomplete('Enable when subscription support is implemented');
$this->assertEquals(
['data' => ['subscribeToEnum' => 'GREEN'], 'errors' => [[]]],
['data' => ['subscribeToEnum' => 'GREEN']],
GraphQL::execute(
$this->schema,
'subscription x($color: Color!) { subscribeToEnum(color: $color) }',