2016-04-25 12:23:10 +03:00
|
|
|
<?php
|
2018-09-01 18:07:06 +03:00
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
2016-04-25 12:23:10 +03:00
|
|
|
namespace GraphQL\Tests\Executor;
|
|
|
|
|
|
|
|
use GraphQL\Executor\ExecutionResult;
|
2018-07-29 18:43:10 +03:00
|
|
|
use PHPUnit\Framework\TestCase;
|
2016-04-25 12:23:10 +03:00
|
|
|
|
2018-07-29 18:43:10 +03:00
|
|
|
class ExecutionResultTest extends TestCase
|
2016-04-25 12:23:10 +03:00
|
|
|
{
|
2018-08-31 12:07:29 +03:00
|
|
|
public function testToArrayWithoutExtensions() : void
|
2016-04-25 12:23:10 +03:00
|
|
|
{
|
|
|
|
$executionResult = new ExecutionResult();
|
|
|
|
|
2016-10-18 18:25:39 +03:00
|
|
|
$this->assertEquals([], $executionResult->toArray());
|
2016-04-25 12:23:10 +03:00
|
|
|
}
|
|
|
|
|
2018-08-31 12:07:29 +03:00
|
|
|
public function testToArrayExtensions() : void
|
2016-04-25 12:23:10 +03:00
|
|
|
{
|
|
|
|
$executionResult = new ExecutionResult(null, [], ['foo' => 'bar']);
|
|
|
|
|
2016-10-18 18:25:39 +03:00
|
|
|
$this->assertEquals(['extensions' => ['foo' => 'bar']], $executionResult->toArray());
|
2016-04-25 12:23:10 +03:00
|
|
|
|
|
|
|
$executionResult->extensions = ['bar' => 'foo'];
|
|
|
|
|
2016-10-18 18:25:39 +03:00
|
|
|
$this->assertEquals(['extensions' => ['bar' => 'foo']], $executionResult->toArray());
|
2016-04-25 12:23:10 +03:00
|
|
|
}
|
|
|
|
}
|