graphql-php/tests/Executor/ExecutionResultTest.php
2018-09-01 20:05:38 +02:00

30 lines
757 B
PHP

<?php
declare(strict_types=1);
namespace GraphQL\Tests\Executor;
use GraphQL\Executor\ExecutionResult;
use PHPUnit\Framework\TestCase;
class ExecutionResultTest extends TestCase
{
public function testToArrayWithoutExtensions() : void
{
$executionResult = new ExecutionResult();
$this->assertEquals([], $executionResult->toArray());
}
public function testToArrayExtensions() : void
{
$executionResult = new ExecutionResult(null, [], ['foo' => 'bar']);
$this->assertEquals(['extensions' => ['foo' => 'bar']], $executionResult->toArray());
$executionResult->extensions = ['bar' => 'foo'];
$this->assertEquals(['extensions' => ['bar' => 'foo']], $executionResult->toArray());
}
}