graphql-php/tests/UtilsTest.php
2018-07-29 19:01:39 +02:00

19 lines
501 B
PHP

<?php
namespace GraphQL\Tests;
use GraphQL\Utils\Utils;
use PHPUnit\Framework\TestCase;
class UtilsTest extends TestCase
{
public function testAssignThrowsExceptionOnMissingRequiredKey()
{
$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']);
}
}