graphql-php/tests/Executor/ExecutionResultTest.php

30 lines
754 B
PHP
Raw Permalink Normal View History

<?php
2018-09-01 18:07:06 +03:00
declare(strict_types=1);
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() : void
{
$executionResult = new ExecutionResult();
2018-09-19 18:12:09 +03:00
self::assertEquals([], $executionResult->toArray());
}
public function testToArrayExtensions() : void
{
$executionResult = new ExecutionResult(null, [], ['foo' => 'bar']);
2018-09-19 18:12:09 +03:00
self::assertEquals(['extensions' => ['foo' => 'bar']], $executionResult->toArray());
$executionResult->extensions = ['bar' => 'foo'];
2018-09-19 18:12:09 +03:00
self::assertEquals(['extensions' => ['bar' => 'foo']], $executionResult->toArray());
}
}