Use PSR-4 Autoloader for tests

This commit is contained in:
Jeremiah VALERIE 2016-04-09 09:36:53 +02:00
parent 7cb99cc3ff
commit 1bc5e0c9da
44 changed files with 82 additions and 54 deletions

View File

@ -23,10 +23,8 @@
} }
}, },
"autoload-dev": { "autoload-dev": {
"classmap": [ "psr-4": {
"tests/" "GraphQL\\Tests\\": "tests/"
], }
"files": [
]
} }
} }

View File

@ -1,8 +1,8 @@
<?php <?php
namespace GraphQL\Executor; namespace GraphQL\Tests\Executor;
require_once __DIR__ . '/TestClasses.php';
use GraphQL\Executor\ExecutionResult;
use GraphQL\Executor\Executor;
use GraphQL\Language\Parser; use GraphQL\Language\Parser;
use GraphQL\Schema; use GraphQL\Schema;
use GraphQL\Type\Definition\InterfaceType; use GraphQL\Type\Definition\InterfaceType;

View File

@ -1,6 +1,7 @@
<?php <?php
namespace GraphQL\Executor; namespace GraphQL\Tests\Executor;
use GraphQL\Executor\Executor;
use GraphQL\Language\Parser; use GraphQL\Language\Parser;
use GraphQL\Schema; use GraphQL\Schema;
use GraphQL\Type\Definition\ObjectType; use GraphQL\Type\Definition\ObjectType;

View File

@ -1,6 +1,7 @@
<?php <?php
namespace GraphQL\Executor; namespace GraphQL\Tests\Executor;
use GraphQL\Executor\Executor;
use GraphQL\Language\Parser; use GraphQL\Language\Parser;
use GraphQL\Schema; use GraphQL\Schema;
use GraphQL\Type\Definition\Config; use GraphQL\Type\Definition\Config;

View File

@ -1,7 +1,8 @@
<?php <?php
namespace GraphQL\Executor; namespace GraphQL\Tests\Executor;
use GraphQL\Error; use GraphQL\Error;
use GraphQL\Executor\Executor;
use GraphQL\FormattedError; use GraphQL\FormattedError;
use GraphQL\Language\Parser; use GraphQL\Language\Parser;
use GraphQL\Language\SourceLocation; use GraphQL\Language\SourceLocation;

View File

@ -1,7 +1,8 @@
<?php <?php
namespace GraphQL\Executor; namespace GraphQL\Tests\Executor;
use GraphQL\Error; use GraphQL\Error;
use GraphQL\Executor\Executor;
use GraphQL\FormattedError; use GraphQL\FormattedError;
use GraphQL\Language\Parser; use GraphQL\Language\Parser;
use GraphQL\Language\SourceLocation; use GraphQL\Language\SourceLocation;
@ -383,4 +384,4 @@ class ListsTest extends \PHPUnit_Framework_TestCase
} }
]; ];
} }
} }

View File

@ -1,6 +1,7 @@
<?php <?php
namespace GraphQL\Executor; namespace GraphQL\Tests\Executor;
use GraphQL\Executor\Executor;
use GraphQL\FormattedError; use GraphQL\FormattedError;
use GraphQL\Language\Parser; use GraphQL\Language\Parser;
use GraphQL\Language\SourceLocation; use GraphQL\Language\SourceLocation;

View File

@ -1,7 +1,8 @@
<?php <?php
namespace GraphQL\Executor; namespace GraphQL\Tests\Executor;
use GraphQL\Error; use GraphQL\Error;
use GraphQL\Executor\Executor;
use GraphQL\FormattedError; use GraphQL\FormattedError;
use GraphQL\Language\Parser; use GraphQL\Language\Parser;
use GraphQL\Language\SourceLocation; use GraphQL\Language\SourceLocation;

View File

@ -1,5 +1,5 @@
<?php <?php
namespace GraphQL\Executor; namespace GraphQL\Tests\Executor;
use GraphQL\Type\Definition\ScalarType; use GraphQL\Type\Definition\ScalarType;

View File

@ -1,8 +1,9 @@
<?php <?php
namespace GraphQL\Executor; namespace GraphQL\Tests\Executor;
require_once __DIR__ . '/TestClasses.php'; require_once __DIR__ . '/TestClasses.php';
use GraphQL\Executor\Executor;
use GraphQL\Language\Parser; use GraphQL\Language\Parser;
use GraphQL\Schema; use GraphQL\Schema;
use GraphQL\Type\Definition\Config; use GraphQL\Type\Definition\Config;

View File

@ -1,9 +1,10 @@
<?php <?php
namespace GraphQL\Executor; namespace GraphQL\Tests\Executor;
require_once __DIR__ . '/TestClasses.php'; require_once __DIR__ . '/TestClasses.php';
use GraphQL\Error; use GraphQL\Error;
use GraphQL\Executor\Executor;
use GraphQL\FormattedError; use GraphQL\FormattedError;
use GraphQL\Language\Parser; use GraphQL\Language\Parser;
use GraphQL\Language\SourceLocation; use GraphQL\Language\SourceLocation;

View File

@ -1,6 +1,9 @@
<?php <?php
namespace GraphQL\Language; namespace GraphQL\Tests\Language;
use GraphQL\Language\Lexer;
use GraphQL\Language\Source;
use GraphQL\Language\Token;
use GraphQL\SyntaxError; use GraphQL\SyntaxError;
class LexerTest extends \PHPUnit_Framework_TestCase class LexerTest extends \PHPUnit_Framework_TestCase

View File

@ -1,5 +1,5 @@
<?php <?php
namespace GraphQL\Language; namespace GraphQL\Tests\Language;
use GraphQL\Error; use GraphQL\Error;
use GraphQL\Language\AST\Argument; use GraphQL\Language\AST\Argument;
@ -10,6 +10,9 @@ use GraphQL\Language\AST\Location;
use GraphQL\Language\AST\Name; use GraphQL\Language\AST\Name;
use GraphQL\Language\AST\OperationDefinition; use GraphQL\Language\AST\OperationDefinition;
use GraphQL\Language\AST\SelectionSet; use GraphQL\Language\AST\SelectionSet;
use GraphQL\Language\Parser;
use GraphQL\Language\Source;
use GraphQL\Language\SourceLocation;
use GraphQL\SyntaxError; use GraphQL\SyntaxError;
class ParserTest extends \PHPUnit_Framework_TestCase class ParserTest extends \PHPUnit_Framework_TestCase

View File

@ -1,5 +1,5 @@
<?php <?php
namespace GraphQL\Language; namespace GraphQL\Tests\Language;
use GraphQL\Language\AST\Document; use GraphQL\Language\AST\Document;
use GraphQL\Language\AST\EnumValue; use GraphQL\Language\AST\EnumValue;
@ -10,6 +10,8 @@ use GraphQL\Language\AST\SelectionSet;
use GraphQL\Language\AST\StringValue; use GraphQL\Language\AST\StringValue;
use GraphQL\Language\AST\Variable; use GraphQL\Language\AST\Variable;
use GraphQL\Language\AST\VariableDefinition; use GraphQL\Language\AST\VariableDefinition;
use GraphQL\Language\Parser;
use GraphQL\Language\Printer;
class PrinterTest extends \PHPUnit_Framework_TestCase class PrinterTest extends \PHPUnit_Framework_TestCase
{ {

View File

@ -1,10 +1,12 @@
<?php <?php
namespace GraphQL\Language; namespace GraphQL\Tests\Language;
use GraphQL\Language\AST\Field; use GraphQL\Language\AST\Field;
use GraphQL\Language\AST\Name; use GraphQL\Language\AST\Name;
use GraphQL\Language\AST\Node; use GraphQL\Language\AST\Node;
use GraphQL\Language\AST\SelectionSet; use GraphQL\Language\AST\SelectionSet;
use GraphQL\Language\Parser;
use GraphQL\Language\Visitor;
class VisitorTest extends \PHPUnit_Framework_TestCase class VisitorTest extends \PHPUnit_Framework_TestCase
{ {

View File

@ -1,5 +1,5 @@
<?php <?php
namespace GraphQL; namespace GraphQL\Tests;
class StarWarsData class StarWarsData
{ {

View File

@ -1,7 +1,9 @@
<?php <?php
namespace GraphQL; namespace GraphQL\Tests;
use GraphQL\GraphQL;
class StarWarsIntrospectionTest extends \PHPUnit_Framework_TestCase class StarWarsIntrospectionTest extends \PHPUnit_Framework_TestCase
{ {
// Star Wars Introspection Tests // Star Wars Introspection Tests

View File

@ -1,7 +1,9 @@
<?php <?php
namespace GraphQL; namespace GraphQL\Tests;
use GraphQL\GraphQL;
class StarWarsQueryTest extends \PHPUnit_Framework_TestCase class StarWarsQueryTest extends \PHPUnit_Framework_TestCase
{ {
// Star Wars Query Tests // Star Wars Query Tests

View File

@ -1,5 +1,5 @@
<?php <?php
namespace GraphQL; namespace GraphQL\Tests;
/** /**
* This is designed to be an end-to-end test, demonstrating * This is designed to be an end-to-end test, demonstrating
@ -11,6 +11,7 @@ namespace GraphQL;
* NOTE: This may contain spoilers for the original Star * NOTE: This may contain spoilers for the original Star
* Wars trilogy. * Wars trilogy.
*/ */
use GraphQL\Schema;
use GraphQL\Type\Definition\EnumType; use GraphQL\Type\Definition\EnumType;
use GraphQL\Type\Definition\InterfaceType; use GraphQL\Type\Definition\InterfaceType;
use GraphQL\Type\Definition\NonNull; use GraphQL\Type\Definition\NonNull;

View File

@ -1,5 +1,5 @@
<?php <?php
namespace GraphQL; namespace GraphQL\Tests;
use GraphQL\Language\Parser; use GraphQL\Language\Parser;
use GraphQL\Validator\DocumentValidator; use GraphQL\Validator\DocumentValidator;

View File

@ -1,5 +1,5 @@
<?php <?php
namespace GraphQL\Type; namespace GraphQL\Tests\Type;
use GraphQL\Schema; use GraphQL\Schema;
use GraphQL\Type\Definition\Config; use GraphQL\Type\Definition\Config;

View File

@ -1,5 +1,5 @@
<?php <?php
namespace GraphQL\Type; namespace GraphQL\Tests\Type;
use GraphQL\FormattedError; use GraphQL\FormattedError;
use GraphQL\Language\SourceLocation; use GraphQL\Language\SourceLocation;
@ -9,6 +9,7 @@ use GraphQL\Type\Definition\EnumType;
use GraphQL\Type\Definition\InputObjectType; use GraphQL\Type\Definition\InputObjectType;
use GraphQL\Type\Definition\ObjectType; use GraphQL\Type\Definition\ObjectType;
use GraphQL\Type\Definition\Type; use GraphQL\Type\Definition\Type;
use GraphQL\Type\Introspection;
use GraphQL\Validator\Rules\ProvidedNonNullArguments; use GraphQL\Validator\Rules\ProvidedNonNullArguments;
class IntrospectionTest extends \PHPUnit_Framework_TestCase class IntrospectionTest extends \PHPUnit_Framework_TestCase

View File

@ -1,5 +1,5 @@
<?php <?php
namespace GraphQL\Type; namespace GraphQL\Tests\Type;
use GraphQL\GraphQL; use GraphQL\GraphQL;
use GraphQL\Schema; use GraphQL\Schema;
@ -153,4 +153,4 @@ class ResolveInfoTest extends \PHPUnit_Framework_TestCase
$this->assertEquals($expectedDefaultSelection, $actualDefaultSelection); $this->assertEquals($expectedDefaultSelection, $actualDefaultSelection);
$this->assertEquals($expectedDeepSelection, $actualDeepSelection); $this->assertEquals($expectedDeepSelection, $actualDeepSelection);
} }
} }

View File

@ -1,5 +1,5 @@
<?php <?php
namespace GraphQL\Type; namespace GraphQL\Tests\Type;
use GraphQL\Type\Definition\Type; use GraphQL\Type\Definition\Type;
@ -60,4 +60,4 @@ class ScalarSerializationTest extends \PHPUnit_Framework_TestCase
// TODO: how should it behaive on '0'? // TODO: how should it behaive on '0'?
} }
} }

View File

@ -1,5 +1,5 @@
<?php <?php
namespace GraphQL\Type; namespace GraphQL\Tests\Type;
use GraphQL\Schema; use GraphQL\Schema;
use GraphQL\Type\Definition\InputObjectType; use GraphQL\Type\Definition\InputObjectType;
@ -9,6 +9,8 @@ use GraphQL\Type\Definition\NonNull;
use GraphQL\Type\Definition\ObjectType; use GraphQL\Type\Definition\ObjectType;
use GraphQL\Type\Definition\Type; use GraphQL\Type\Definition\Type;
use GraphQL\Type\Definition\UnionType; use GraphQL\Type\Definition\UnionType;
use GraphQL\Type\Introspection;
use GraphQL\Type\SchemaValidator;
class SchemaValidatorTest extends \PHPUnit_Framework_TestCase class SchemaValidatorTest extends \PHPUnit_Framework_TestCase
{ {

View File

@ -1,5 +1,5 @@
<?php <?php
namespace GraphQL\Validator; namespace GraphQL\Tests\Validator;
use GraphQL\FormattedError; use GraphQL\FormattedError;
use GraphQL\Language\SourceLocation; use GraphQL\Language\SourceLocation;

View File

@ -1,8 +1,9 @@
<?php <?php
namespace GraphQL\Validator; namespace GraphQL\Tests\Validator;
use GraphQL\FormattedError; use GraphQL\FormattedError;
use GraphQL\Language\SourceLocation; use GraphQL\Language\SourceLocation;
use GraphQL\Validator\Messages;
use GraphQL\Validator\Rules\DefaultValuesOfCorrectType; use GraphQL\Validator\Rules\DefaultValuesOfCorrectType;
class DefaultValuesOfCorrectTypeTest extends TestCase class DefaultValuesOfCorrectTypeTest extends TestCase

View File

@ -1,8 +1,9 @@
<?php <?php
namespace GraphQL\Validator; namespace GraphQL\Tests\Validator;
use GraphQL\FormattedError; use GraphQL\FormattedError;
use GraphQL\Language\SourceLocation; use GraphQL\Language\SourceLocation;
use GraphQL\Validator\Messages;
use GraphQL\Validator\Rules\FieldsOnCorrectType; use GraphQL\Validator\Rules\FieldsOnCorrectType;
class FieldsOnCorrectTypeTest extends TestCase class FieldsOnCorrectTypeTest extends TestCase

View File

@ -1,5 +1,5 @@
<?php <?php
namespace GraphQL\Validator; namespace GraphQL\Tests\Validator;
use GraphQL\FormattedError; use GraphQL\FormattedError;
use GraphQL\Language\SourceLocation; use GraphQL\Language\SourceLocation;

View File

@ -1,5 +1,5 @@
<?php <?php
namespace GraphQL\Validator; namespace GraphQL\Tests\Validator;
use GraphQL\FormattedError; use GraphQL\FormattedError;
use GraphQL\Language\SourceLocation; use GraphQL\Language\SourceLocation;

View File

@ -1,5 +1,5 @@
<?php <?php
namespace GraphQL\Validator; namespace GraphQL\Tests\Validator;
use GraphQL\FormattedError; use GraphQL\FormattedError;
use GraphQL\Language\SourceLocation; use GraphQL\Language\SourceLocation;

View File

@ -1,5 +1,5 @@
<?php <?php
namespace GraphQL\Validator; namespace GraphQL\Tests\Validator;
use GraphQL\Validator\Rules\KnownFragmentNames; use GraphQL\Validator\Rules\KnownFragmentNames;
use GraphQL\FormattedError; use GraphQL\FormattedError;

View File

@ -1,5 +1,5 @@
<?php <?php
namespace GraphQL\Validator; namespace GraphQL\Tests\Validator;
use GraphQL\FormattedError; use GraphQL\FormattedError;
use GraphQL\Language\SourceLocation; use GraphQL\Language\SourceLocation;

View File

@ -1,5 +1,5 @@
<?php <?php
namespace GraphQL\Validator; namespace GraphQL\Tests\Validator;
use GraphQL\FormattedError; use GraphQL\FormattedError;
use GraphQL\Language\SourceLocation; use GraphQL\Language\SourceLocation;

View File

@ -1,5 +1,5 @@
<?php <?php
namespace GraphQL\Validator; namespace GraphQL\Tests\Validator;
use GraphQL\FormattedError; use GraphQL\FormattedError;
use GraphQL\Language\SourceLocation; use GraphQL\Language\SourceLocation;

View File

@ -1,5 +1,5 @@
<?php <?php
namespace GraphQL\Validator; namespace GraphQL\Tests\Validator;
use GraphQL\FormattedError; use GraphQL\FormattedError;
use GraphQL\Language\SourceLocation; use GraphQL\Language\SourceLocation;

View File

@ -1,5 +1,5 @@
<?php <?php
namespace GraphQL\Validator; namespace GraphQL\Tests\Validator;
use GraphQL\FormattedError; use GraphQL\FormattedError;
use GraphQL\Language\SourceLocation; use GraphQL\Language\SourceLocation;

View File

@ -1,5 +1,5 @@
<?php <?php
namespace GraphQL\Validator; namespace GraphQL\Tests\Validator;
use GraphQL\FormattedError; use GraphQL\FormattedError;
use GraphQL\Language\Source; use GraphQL\Language\Source;

View File

@ -1,5 +1,5 @@
<?php <?php
namespace GraphQL\Validator; namespace GraphQL\Tests\Validator;
use GraphQL\FormattedError; use GraphQL\FormattedError;
use GraphQL\Language\SourceLocation; use GraphQL\Language\SourceLocation;

View File

@ -1,5 +1,5 @@
<?php <?php
namespace GraphQL\Validator; namespace GraphQL\Tests\Validator;
use GraphQL\FormattedError; use GraphQL\FormattedError;
use GraphQL\Language\SourceLocation; use GraphQL\Language\SourceLocation;

View File

@ -1,5 +1,5 @@
<?php <?php
namespace GraphQL\Validator; namespace GraphQL\Tests\Validator;
use GraphQL\FormattedError; use GraphQL\FormattedError;
use GraphQL\Language\SourceLocation; use GraphQL\Language\SourceLocation;

View File

@ -1,5 +1,5 @@
<?php <?php
namespace GraphQL\Validator; namespace GraphQL\Tests\Validator;
use GraphQL\Language\Parser; use GraphQL\Language\Parser;
use GraphQL\Schema; use GraphQL\Schema;
@ -10,6 +10,7 @@ use GraphQL\Type\Definition\ListOfType;
use GraphQL\Type\Definition\ObjectType; use GraphQL\Type\Definition\ObjectType;
use GraphQL\Type\Definition\Type; use GraphQL\Type\Definition\Type;
use GraphQL\Type\Definition\UnionType; use GraphQL\Type\Definition\UnionType;
use GraphQL\Validator\DocumentValidator;
abstract class TestCase extends \PHPUnit_Framework_TestCase abstract class TestCase extends \PHPUnit_Framework_TestCase
{ {

View File

@ -1,5 +1,5 @@
<?php <?php
namespace GraphQL\Validator; namespace GraphQL\Tests\Validator;
use GraphQL\FormattedError; use GraphQL\FormattedError;
use GraphQL\Language\SourceLocation; use GraphQL\Language\SourceLocation;
@ -39,4 +39,4 @@ class VariablesAreInputTypesTest extends TestCase
] ]
); );
} }
} }

View File

@ -1,8 +1,9 @@
<?php <?php
namespace GraphQL\Validator; namespace GraphQL\Tests\Validator;
use GraphQL\FormattedError; use GraphQL\FormattedError;
use GraphQL\Language\SourceLocation; use GraphQL\Language\SourceLocation;
use GraphQL\Validator\Messages;
use GraphQL\Validator\Rules\VariablesInAllowedPosition; use GraphQL\Validator\Rules\VariablesInAllowedPosition;
class VariablesInAllowedPositionTest extends TestCase class VariablesInAllowedPositionTest extends TestCase