Suppressing Config deprecation warning in tests

This commit is contained in:
Vladimir Razuvaev 2017-08-18 18:07:23 +07:00
parent 637156fe65
commit 9499e5ae8e
2 changed files with 9 additions and 1 deletions

View File

@ -8,6 +8,7 @@ use GraphQL\Utils\Utils;
/**
* Class Config
* @package GraphQL\Type\Definition
* @deprecated See https://github.com/webonyx/graphql-php/issues/148 for alternatives
*/
class Config
{
@ -43,7 +44,10 @@ class Config
private static $allowCustomOptions = true;
/**
*
* Disables config validation
*
* @deprecated See https://github.com/webonyx/graphql-php/issues/148 for alternatives
*/
public static function disableValidation()
{
@ -53,6 +57,8 @@ class Config
/**
* Enable deep config validation (disabled by default because it creates significant performance overhead).
* Useful only at development to catch type definition errors quickly.
*
* @deprecated See https://github.com/webonyx/graphql-php/issues/148 for alternatives
*/
public static function enableValidation($allowCustomOptions = true)
{

View File

@ -2,6 +2,7 @@
namespace GraphQL\Tests\Type;
use GraphQL\Error\InvariantViolation;
use GraphQL\Error\Warning;
use GraphQL\Type\Definition\Config;
use GraphQL\Type\Definition\EnumType;
use GraphQL\Type\Definition\InputObjectType;
@ -14,12 +15,13 @@ class ConfigTest extends \PHPUnit_Framework_TestCase
{
public function setUp()
{
\PHPUnit_Framework_Error_Deprecated::$enabled = false;
Warning::suppress(Warning::CONFIG_DEPRECATION_WARNING);
}
public static function tearDownAfterClass()
{
Config::disableValidation();
Warning::enable(Warning::CONFIG_DEPRECATION_WARNING);
}
public function testToggling()