Skip to content

Commit

Permalink
Code formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
viniychuk committed May 18, 2016
1 parent 7775dab commit 6b2d507
Show file tree
Hide file tree
Showing 78 changed files with 1,536 additions and 1,495 deletions.
2 changes: 1 addition & 1 deletion .scrutinizer.yml
Expand Up @@ -3,4 +3,4 @@ imports:

tools:
external_code_coverage:
timeout: 600
timeout: 600
2 changes: 1 addition & 1 deletion Tests/DataProvider/TestConfig.php
Expand Up @@ -17,7 +17,7 @@ class TestConfig extends AbstractConfig
public function getRules()
{
return [
'name' => ['type' => TypeService::TYPE_ANY, 'required' => true],
'name' => ['type' => TypeService::TYPE_ANY, 'required' => true],
'resolve' => ['type' => TypeService::TYPE_CALLABLE, 'final' => true],
];
}
Expand Down
2 changes: 1 addition & 1 deletion Tests/DataProvider/TestConfigInvalidRule.php
Expand Up @@ -11,7 +11,7 @@ class TestConfigInvalidRule extends AbstractConfig
public function getRules()
{
return [
'name' => ['type' => TypeService::TYPE_ANY, 'required' => true],
'name' => ['type' => TypeService::TYPE_ANY, 'required' => true],
'invalidRuleField' => ['type' => TypeService::TYPE_ANY, 'invalid rule' => true]
];
}
Expand Down
18 changes: 9 additions & 9 deletions Tests/DataProvider/TestSchema.php
Expand Up @@ -19,31 +19,31 @@ class TestSchema extends AbstractSchema
public function build(SchemaConfig $config)
{
$config->getQuery()->addFields([
'me' => [
'type' => new TestObjectType(),
'resolve' => function($value, $args, TestObjectType $type) {
'me' => [
'type' => new TestObjectType(),
'resolve' => function ($value, $args, TestObjectType $type) {
return $type->getData();
}
],
'status' => [
'type' => new TestEnumType(),
'resolve' => function() {
'type' => new TestEnumType(),
'resolve' => function () {
return $this->testStatusValue;
}
],
]);
$config->getMutation()->addFields([
'updateStatus' => [
'type' => new TestEnumType(),
'resolve' => function() {
'type' => new TestEnumType(),
'resolve' => function () {
return $this->testStatusValue;
},
'args' => [
'args' => [
'newStatus' => new TestEnumType()
]
]
]);
}


}
}
10 changes: 5 additions & 5 deletions Tests/Library/Config/ConfigTest.php
Expand Up @@ -45,9 +45,9 @@ public function testInvalidMethod()

public function testMethods()
{
$name = 'Test';
$name = 'Test';
$rules = [
'name' => ['type' => TypeService::TYPE_ANY, 'required' => true],
'name' => ['type' => TypeService::TYPE_ANY, 'required' => true],
'resolve' => ['type' => TypeService::TYPE_CALLABLE, 'final' => true],
];

Expand All @@ -69,15 +69,15 @@ public function testMethods()
$this->assertNull($config->getResolveFunction());

$object = new ObjectType([
'name' => 'TestObject',
'name' => 'TestObject',
'fields' => [
'id' => [
'type' => new IntType()
]
]
]);

$finalConfig = new TestConfig(['name' => $name . 'final', 'resolve' => function() { return []; }], $object, true);
$finalConfig = new TestConfig(['name' => $name . 'final', 'resolve' => function () { return []; }], $object, true);
$this->assertEquals($finalConfig->getType(), null);

$rules['resolve']['required'] = true;
Expand All @@ -86,7 +86,7 @@ public function testMethods()
$this->assertNotNull($finalConfig->getResolveFunction());

$configExtraFields = new TestConfigExtraFields([
'name' => 'Test',
'name' => 'Test',
'extraField' => 'extraValue'
]);
$this->assertEquals('extraValue', $configExtraFields->get('extraField'));
Expand Down
6 changes: 3 additions & 3 deletions Tests/Library/Config/FieldConfigTest.php
Expand Up @@ -18,9 +18,9 @@ class FieldConfigTest extends \PHPUnit_Framework_TestCase
public function testInvalidParams()
{
$fieldConfig = new FieldConfig([
'name' => 'FirstName',
'type' => new StringType(),
'resolve' => function($value, $args = [], $type = null) {
'name' => 'FirstName',
'type' => new StringType(),
'resolve' => function ($value, $args = [], $type = null) {
return 'John';
}
]);
Expand Down
8 changes: 4 additions & 4 deletions Tests/Library/Config/InterfaceTypeConfigTest.php
Expand Up @@ -58,15 +58,15 @@ public function testInterfaces()
return $object->getType();
}
], null, true);
$object = new ObjectType(['name' => 'User', 'fields' => ['name' => new StringType()]]);
$object = new ObjectType(['name' => 'User', 'fields' => ['name' => new StringType()]]);

$this->assertEquals($interfaceConfig->getName(), 'Test');
$this->assertEquals($interfaceConfig->resolveType($object), $object->getType());

$testInterface = new TestInterfaceType();
$testInterface = new TestInterfaceType();
$interfaceConfigWithNoResolve = new InterfaceTypeConfig([
'name' => 'Test',
'fields' => ['id' => new IntType()]
'name' => 'Test',
'fields' => ['id' => new IntType()]
], $testInterface, false);
$this->assertEquals($interfaceConfigWithNoResolve->resolveType($object), $object);
}
Expand Down
1 change: 0 additions & 1 deletion Tests/Library/Config/ObjectTypeConfigTest.php
Expand Up @@ -45,5 +45,4 @@ public function testInterfaces()
}



}
4 changes: 2 additions & 2 deletions Tests/Library/Field/ArgumentsAwareConfigTraitTest.php
Expand Up @@ -19,10 +19,10 @@ class ArgumentsAwareConfigTraitTest extends \PHPUnit_Framework_TestCase

public function testArguments()
{
$argsData = [
$argsData = [
'id' => new IntType()
];
$config = new FieldConfig([
$config = new FieldConfig([
'name' => 'UserType',
'type' => new IntType(),
'args' => $argsData
Expand Down
4 changes: 3 additions & 1 deletion Tests/Library/Field/FieldTest.php
Expand Up @@ -56,6 +56,7 @@ public function testObjectFieldCreation()
$this->assertEquals(new IntType(), $field->getType());
$this->assertEquals('test', $field->resolve('test'));
}

public function testArgumentsTrait()
{
$testField = new TestField();
Expand All @@ -70,13 +71,14 @@ public function testArgumentsTrait()
new InputField(['name' => 'name', 'type' => new StringType()])
]);
$this->assertEquals([
'id' => new InputField(['name' => 'id', 'type' => new IntType()]),
'id' => new InputField(['name' => 'id', 'type' => new IntType()]),
'name' => new InputField(['name' => 'name', 'type' => new StringType()]),
], $testField->getArguments());

$testField->removeArgument('name');
$this->assertFalse($testField->hasArgument('name'));
}

/**
* @param $fieldConfig
*
Expand Down
4 changes: 2 additions & 2 deletions Tests/Library/Relay/CallableFetcherTest.php
Expand Up @@ -16,10 +16,10 @@ class CallableFetcherTest extends \PHPUnit_Framework_TestCase
{
public function testMethods()
{
$fetcher = new CallableFetcher(function($type, $id) { return ['name' => $type . ' Name', 'id' => $id]; }, function($object) { return $object; });
$fetcher = new CallableFetcher(function ($type, $id) { return ['name' => $type . ' Name', 'id' => $id]; }, function ($object) { return $object; });
$this->assertEquals([
'name' => 'User Name',
'id' => 12
'id' => 12
], $fetcher->resolveNode('User', 12));

$object = new TestObjectType();
Expand Down
4 changes: 2 additions & 2 deletions Tests/Library/Relay/NodeFieldTest.php
Expand Up @@ -17,8 +17,8 @@ class NodeFieldTest extends \PHPUnit_Framework_TestCase

public function testMethods()
{
$fetcher = new CallableFetcher(function() {}, function() {});
$field = new NodeField($fetcher);
$fetcher = new CallableFetcher(function () { }, function () { });
$field = new NodeField($fetcher);

$this->assertEquals('Fetches an object given its ID', $field->getDescription());
$this->assertEquals('node', $field->getName());
Expand Down
2 changes: 1 addition & 1 deletion Tests/Library/Relay/NodeTest.php
Expand Up @@ -15,7 +15,7 @@ class NodeTest extends \PHPUnit_Framework_TestCase
{
public function testMethods()
{
$global = Node::toGlobalId('user', 1);
$global = Node::toGlobalId('user', 1);
$fromGlobal = Node::fromGlobalId($global);

$this->assertEquals('user', $fromGlobal[0]);
Expand Down
2 changes: 1 addition & 1 deletion Tests/Library/Type/InputObjectTypeTest.php
Expand Up @@ -21,7 +21,7 @@ class InputObjectTypeTest extends \PHPUnit_Framework_TestCase
public function testInternal()
{
$inputObjectType = new InputObjectType([
'name' => 'PostData',
'name' => 'PostData',
'fields' => [
'title' => new NonNullType(new StringType())
]
Expand Down
12 changes: 6 additions & 6 deletions Tests/Library/Type/InterfaceTypeTest.php
Expand Up @@ -22,12 +22,12 @@ public function testInterfaceMethods()
{
$interface = new TestInterfaceType();
$this->assertEquals($interface->getNamedType(), $interface->getType());
$this->assertEquals(['name' => new Field(['name' => 'name', 'type'=> new StringType()])],
$this->assertEquals(['name' => new Field(['name' => 'name', 'type' => new StringType()])],
$interface->getFields());

$object = new ObjectType([
'name' => 'Test',
'fields' => [
'name' => 'Test',
'fields' => [
'name' => new StringType()
],
'interfaces' => [$interface],
Expand All @@ -39,11 +39,11 @@ public function testInterfaceMethods()
$this->assertEquals($interface->serialize($object), $object);

$interfaceType = new InterfaceType([
'name' => 'UserInterface',
'fields' => [
'name' => 'UserInterface',
'fields' => [
'name' => new StringType()
],
'resolveType' => function($object) {
'resolveType' => function ($object) {
return $object;
}
]);
Expand Down
6 changes: 3 additions & 3 deletions Tests/Library/Type/NonNullTypeTest.php
Expand Up @@ -27,10 +27,10 @@ public function testInvalidParams()

public function testNonNullType()
{
$stringType = new StringType();
$nonNullType = new NonNullType(new StringType());
$stringType = new StringType();
$nonNullType = new NonNullType(new StringType());
$nonNullOnString = new NonNullType(TypeMap::TYPE_STRING);
$testArray = ['a' => 'b'];
$testArray = ['a' => 'b'];

$this->assertEquals($nonNullType->getName(), null, 'Empty non-null name');
$this->assertEquals($nonNullType->getKind(), TypeMap::KIND_NON_NULL);
Expand Down
14 changes: 7 additions & 7 deletions Tests/Library/Type/ObjectTypeTest.php
Expand Up @@ -45,7 +45,7 @@ public function testInvalidNameParam()
public function testInvalidFieldsParam()
{
new ObjectType([
'name' => 'SomeName',
'name' => 'SomeName',
'fields' => []
]);
}
Expand All @@ -56,7 +56,7 @@ public function testInvalidFieldsParam()
public function testSerialize()
{
$object = new ObjectType([
'name' => 'SomeName',
'name' => 'SomeName',
'fields' => [
'name' => new StringType()
]
Expand All @@ -68,8 +68,8 @@ public function testSerialize()
public function testNormalCreatingParam()
{
$objectType = new ObjectType([
'name' => 'Post',
'fields' => [
'name' => 'Post',
'fields' => [
'id' => new IntType()
],
'description' => 'Post type description'
Expand All @@ -90,8 +90,8 @@ public function testNormalCreatingParam()
public function testFieldsTrait()
{
$objectType = new ObjectType([
'name' => 'Post',
'fields' => [
'name' => 'Post',
'fields' => [
'id' => new IntType()
],
'description' => 'Post type description'
Expand All @@ -103,7 +103,7 @@ public function testFieldsTrait()

$objectType->addField('name', new StringType());
$this->assertEquals([
'id' => new Field(['name' => 'id', 'type' => new IntType()]),
'id' => new Field(['name' => 'id', 'type' => new IntType()]),
'name' => new Field(['name' => 'name', 'type' => new StringType()]),
], $objectType->getFields());
}
Expand Down
2 changes: 1 addition & 1 deletion Tests/Library/Type/ScalarTypeTest.php
Expand Up @@ -21,7 +21,7 @@ class ScalarTypeTest extends \PHPUnit_Framework_TestCase
public function testScalarPrimitives()
{
foreach (TypeFactory::getScalarTypesNames() as $typeName) {
$scalarType = TypeFactory::getScalarType($typeName);
$scalarType = TypeFactory::getScalarType($typeName);
$testDataMethod = 'get' . $typeName . 'TestData';

$this->assertNotEmpty($scalarType->getDescription());
Expand Down
2 changes: 1 addition & 1 deletion Tests/Library/Utilities/ErrorContainerTraitTest.php
Expand Up @@ -36,7 +36,7 @@ public function testAdding()
$this->clearErrors();
$this->addError(new DatableResolveException('Wrong data', 412, ['user_id' => '1']));
$this->assertEquals([
['message' => 'Wrong data', 'code' => 412, 'user_id' => '1' ],
['message' => 'Wrong data', 'code' => 412, 'user_id' => '1'],
], $this->getErrorsArray());

$this->clearErrors();
Expand Down
16 changes: 8 additions & 8 deletions Tests/Library/Validator/ResolveValidatorTest.php
Expand Up @@ -56,7 +56,7 @@ public function testValidMethods()

$validator->assertTypeImplementsInterface($userType, new TestInterfaceType());

$fragment = new Fragment('name', 'User', []);
$fragment = new Fragment('name', 'User', []);
$fragmentReference = new FragmentReference('name');
$validator->assertValidFragmentForField($fragment, $fragmentReference, $userType);
}
Expand Down Expand Up @@ -89,14 +89,14 @@ public function testValidateValue()
*/
public function testInvalidFragmentType()
{
$userType = new ObjectType([
$userType = new ObjectType([
'name' => 'User',
'fields' => [
'name' => new StringType(),
],
]);
$fragmentReference = new FragmentReference('user');
$fragment = new Fragment('name', 'Product', []);
$fragment = new Fragment('name', 'Product', []);

$validator = new ResolveValidator();
$validator->assertValidFragmentForField($fragment, $fragmentReference, $userType);
Expand Down Expand Up @@ -142,19 +142,19 @@ public function testArgumentsValidation()
$request = new Request([]);


$validQuery = new Query('hero', null, [
$validQuery = new Query('hero', null, [
new Argument('planet', new Literal('earth'))
]);
$invalidArgumentQuery = new Query('hero', null, [
$invalidArgumentQuery = new Query('hero', null, [
new Argument('planets', new Literal('earth'))
]);
$invalidArgumentTypeQuery = new Query('hero', null, [
$invalidArgumentTypeQuery = new Query('hero', null, [
new Argument('year', new Literal('invalid type'))
]);
$argumentWithVariable = new Query('hero', null, [
$argumentWithVariable = new Query('hero', null, [
new Argument('year', $variable)
]);
$argumentWithVariableWrongType = new Query('hero', null, [
$argumentWithVariableWrongType = new Query('hero', null, [
new Argument('year', $variableWrongType)
]);

Expand Down

0 comments on commit 6b2d507

Please sign in to comment.