graphql-php/tests/UtilsTest.php

19 lines
501 B
PHP
Raw Normal View History

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