graphql-php/tests/UtilsTest.php
2018-08-31 14:41:18 +02:00

19 lines
508 B
PHP

<?php
namespace GraphQL\Tests;
use GraphQL\Utils\Utils;
use PHPUnit\Framework\TestCase;
class UtilsTest extends TestCase
{
public function testAssignThrowsExceptionOnMissingRequiredKey() : void
{
$object = new \stdClass();
$object->requiredKey = 'value';
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('Key requiredKey is expected to be set and not to be null');
Utils::assign($object, [], ['requiredKey']);
}
}