graphql-php/tests/Executor/ExecutionResultTest.php

27 lines
716 B
PHP
Raw Normal View History

<?php
namespace GraphQL\Tests\Executor;
use GraphQL\Executor\ExecutionResult;
2018-07-29 18:43:10 +03:00
use PHPUnit\Framework\TestCase;
2018-07-29 18:43:10 +03:00
class ExecutionResultTest extends TestCase
{
public function testToArrayWithoutExtensions()
{
$executionResult = new ExecutionResult();
$this->assertEquals([], $executionResult->toArray());
}
public function testToArrayExtensions()
{
$executionResult = new ExecutionResult(null, [], ['foo' => 'bar']);
$this->assertEquals(['extensions' => ['foo' => 'bar']], $executionResult->toArray());
$executionResult->extensions = ['bar' => 'foo'];
$this->assertEquals(['extensions' => ['bar' => 'foo']], $executionResult->toArray());
}
}