From a498643866ff756d4a0f0ff4e33e429bbc43dacc Mon Sep 17 00:00:00 2001 From: Simon Podlipsky Date: Wed, 14 Mar 2018 10:42:11 +0100 Subject: [PATCH] Big :boom: --- .gitignore | 6 + .scrutinizer.yml | 32 +++++ .travis.yml | 47 +++++++ LICENCE | 19 +++ README.md | 189 ++++++++++++++++++++++++++++ composer.json | 36 ++++++ phpcs.xml.dist | 15 +++ phpstan.neon.dist | 13 ++ phpunit.xml.dist | 32 +++++ src/Builder/EnumBuilder.php | 45 +++++++ src/Builder/FieldBuilder.php | 64 ++++++++++ src/Builder/ObjectBuilder.php | 37 ++++++ src/Builder/TypeBuilder.php | 64 ++++++++++ src/Error/Error.php | 13 ++ src/Error/FormattedError.php | 26 ++++ src/Type/DateTimeType.php | 85 +++++++++++++ tests/Builder/EnumBuilderTest.php | 42 +++++++ tests/Builder/FieldBuilderTest.php | 40 ++++++ tests/Builder/ObjectBuilderTest.php | 51 ++++++++ tests/Error/CustomError.php | 13 ++ tests/Error/FormattedErrorTest.php | 82 ++++++++++++ tests/Type/DateTimeTypeTest.php | 84 +++++++++++++ tests/bootstrap.php | 14 +++ 23 files changed, 1049 insertions(+) create mode 100644 .gitignore create mode 100644 .scrutinizer.yml create mode 100644 .travis.yml create mode 100644 LICENCE create mode 100644 README.md create mode 100644 composer.json create mode 100644 phpcs.xml.dist create mode 100644 phpstan.neon.dist create mode 100644 phpunit.xml.dist create mode 100644 src/Builder/EnumBuilder.php create mode 100644 src/Builder/FieldBuilder.php create mode 100644 src/Builder/ObjectBuilder.php create mode 100644 src/Builder/TypeBuilder.php create mode 100644 src/Error/Error.php create mode 100644 src/Error/FormattedError.php create mode 100644 src/Type/DateTimeType.php create mode 100644 tests/Builder/EnumBuilderTest.php create mode 100644 tests/Builder/FieldBuilderTest.php create mode 100644 tests/Builder/ObjectBuilderTest.php create mode 100644 tests/Error/CustomError.php create mode 100644 tests/Error/FormattedErrorTest.php create mode 100644 tests/Type/DateTimeTypeTest.php create mode 100644 tests/bootstrap.php diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..06d082d --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +/vendor/ +/composer.lock +/.phpcs-cache +/phpcs.xml +/phpstan.neon +/phpunit.xml diff --git a/.scrutinizer.yml b/.scrutinizer.yml new file mode 100644 index 0000000..e867edb --- /dev/null +++ b/.scrutinizer.yml @@ -0,0 +1,32 @@ +build: + nodes: + analysis: + environment: + php: + version: 7.2 + cache: + disabled: false + directories: + - ~/.composer/cache + project_setup: + override: true + tests: + override: + - php-scrutinizer-run + - phpcs-run + dependencies: + override: + - composer install --no-interaction --prefer-dist + +checks: + php: + code_rating: true + +tools: + external_code_coverage: true + +build_failure_conditions: + - 'elements.rating(<= C).new.exists' # No new classes/methods with a rating of C or worse allowed + - 'issues.severity(>= MAJOR).new.exists' # New issues of major or higher severity + - 'project.metric_change("scrutinizer.test_coverage", < 0)' # Code Coverage decreased from previous inspection + - 'patches.label("Unused Use Statements").new.exists' # No new unused imports patches allowed diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..3994b11 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,47 @@ +dist: trusty +language: php +sudo: false + +cache: + directories: + - $HOME/.composer/cache + +php: + - 7.2 + - nightly + +before_install: + - composer self-update + - mv ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini{,.disabled} || echo "xdebug not available" + +install: + - travis_retry composer update --prefer-dist + +script: ./vendor/bin/phpunit + +jobs: + include: + - stage: Test + env: COVERAGE + php: 7.2 + before_script: + - mv ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini{.disabled,} + - if [[ ! $(php -m | grep -si xdebug) ]]; then echo "xdebug required for coverage"; exit 1; fi + script: + - ./vendor/bin/phpunit --coverage-clover ./build/logs/clover.xml + after_script: + - wget https://github.com/scrutinizer-ci/ocular/releases/download/1.5.2/ocular.phar + - php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml + + - stage: Code Quality + env: CODING_STANDARD + php: 7.2 + script: + - ./vendor/bin/phpcs + + - stage: Code Quality + env: STATIC_ANALYSIS + php: 7.2 + script: + - ./vendor/bin/phpstan analyse + diff --git a/LICENCE b/LICENCE new file mode 100644 index 0000000..44eddf6 --- /dev/null +++ b/LICENCE @@ -0,0 +1,19 @@ +Copyright (c) 2018 Šimon Podlipský + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..3e69c6c --- /dev/null +++ b/README.md @@ -0,0 +1,189 @@ +# PHP GraphQL Utils for graphql-php + +[![Build Status](https://travis-ci.org/simPod/GraphQL-Utils.svg)](https://travis-ci.org/simPod/GraphQL-Utils) +[![Downloads](https://poser.pugx.org/simpod/graphql-utils/d/total.svg)](https://packagist.org/packages/simpod/graphql-utils) +[![Packagist](https://poser.pugx.org/simpod/graphql-utils/v/stable.svg)](https://packagist.org/packages/simpod/graphql-utils) +[![Licence](https://poser.pugx.org/simpod/graphql-utils/license.svg)](https://packagist.org/packages/simpod/graphql-utils) +[![Quality Score](https://scrutinizer-ci.com/g/simPod/GraphQL-Utils/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/simPod/GraphQL-Utils) +[![Code Coverage](https://scrutinizer-ci.com/g/simPod/GraphQL-Utils/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/simPod/GraphQL-Utils) +[![GitHub Issues](https://img.shields.io/github/issues/simPod/GraphQL-Utils.svg?style=flat-square)](https://github.com/simPod/GraphQL-Utils/issues) + + +## Contents +- [Installation](#installation) +- [Features](#features) + - [Schema Builders](#schema-builders) + - [Types](#types) + - [Error Handling](#error-handling) + +## Installation + +Add as [Composer](https://getcomposer.org/) dependency: + +```sh +composer require simpod/graphql-utils +``` + +## Features + +### Schema Builders + +Instead of defining your schema as an array, use can use more objective-oriented approach. +This library provides set of strictly typed builders that help you build your schema. + +#### ObjectBuilder and FieldBuilder + +✔️ Standard way with `webonyx/graphql-php` + +```php +$userType = new ObjectType([ + 'name' => 'User', + 'description' => 'Our blog visitor', + 'fields' => [ + 'firstName' => [ + 'type' => Type::string(), + 'description' => 'User first name' + ], + 'email' => Type::string() + ] +]); +``` + +✨ The same can be produced in objective way + +```php +use SimPod\GraphQLUtils\Builder\ObjectBuilder; + +... + +$userType = ObjectBuilder::create('User') + ->setDescription('Our blog visitor') + ->setFields([ + FieldBuilder::create('firstName', Type::string()) + ->setDescription('User first name') + ->build(), + FieldBuilder::create('email', Type::string()) + ->build(), + ]) + ->build(); + +``` + +#### EnumBuilder + +✔️ Standard way with `webonyx/graphql-php` + +```php +use SimPod\GraphQLUtils\Builder\EnumBuilder; + +... + +$episodeEnum = new EnumType([ + 'name' => 'Episode', + 'description' => 'One of the films in the Star Wars Trilogy', + 'values' => [ + 'NEWHOPE' => [ + 'value' => 4, + 'description' => 'Released in 1977.' + ], + 'EMPIRE' => [ + 'value' => 5, + 'description' => 'Released in 1980.' + ], + 'JEDI' => [ + 'value' => 6, + 'description' => 'Released in 1983.' + ], + ] +]); +``` + +✨ The same can be produced in objective way + +```php +$episodeEnum = EnumBuilder::create('Episode') + ->setDescription('One of the films in the Star Wars Trilogy') + ->addValue(4, 'NEWHOPE', 'Released in 1977.') + ->addValue(5, 'EMPIRE', 'Released in 1980.') + ->addValue(6, 'JEDI', 'Released in 1983.') + ->build(); +``` + +### Types + +#### 🕰️ DateTime + +scalar type that produces `scalar DateTime` in your schema. + +[`SimPod\GraphQLUtils\Type\DateTimeType`](https://github.com/simPod/GraphQL-Utils/blob/master/src/Type/DateTimeType.php) + +### Error Handling + +Extending your exception with `SimPod\GraphQLUtils\Error\Error` forces you to implement `getType()` method. + +Example Error class + +```php +use SimPod\GraphQLUtils\Error\Error; +use function sprintf; + +final class InvalidCustomerIdProvided extends Error +{ + public const TYPE = 'INVALID_CUSTOMER_ID_PROVIDED'; + + public static function noneGiven() : self + { + return new self('No CustomerId provided'); + } + + public function getType() : string + { + return self::TYPE; + } + + public function isClientSafe() : bool + { + return true; + } +} +``` + +Create your formatter + +```php +use SimPod\GraphQLUtils\Error\FormattedError; + +$formatError = function formatError(Error $error) : array +{ + if (!$error->isClientSafe()) { + // eg. log error + } + + return FormattedError::createFromException($error); +}; + +$errorFormatterCallback = static function (Error $error) use ($formatError) : array { + return $formatError($error); +}; + +$config = GraphQL::executeQuery(/* $args */) + ... + ->setErrorFormatter($errorFormatterCallback) + ->setErrorsHandler( + static function (array $errors, callable $formatter) : array { + return array_map($formatter, $errors); + } + ) +``` + +Error types will then be provided in your response so client can easier identify the error type + +```json +{ + "errors": [ + { + "type": "INVALID_CUSTOMER_ID_PROVIDED", + "message": "No CustomerId provided", + "category": "graphql", + ... +``` diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..418a06f --- /dev/null +++ b/composer.json @@ -0,0 +1,36 @@ +{ + "name": "simpod/graphql-utils", + "description": "GraphQL Utils for graphql-php", + "type": "library", + "license": "MIT", + "authors": [ + { + "name": "Simon Podlipsky", + "email": "simon@podlipsky.net" + } + ], + "config": { + "sort-packages": true + }, + "require": { + "php": "^7.2", + "webonyx/graphql-php": "^0.12" + }, + "require-dev": { + "doctrine/coding-standard": "^5.0", + "phpstan/phpstan": "^0.10.3", + "phpstan/phpstan-phpunit": "^0.10.0", + "phpstan/phpstan-strict-rules": "^0.10.1", + "phpunit/phpunit": "^7.0" + }, + "autoload": { + "psr-4": { + "SimPod\\GraphQLUtils\\": "src/" + } + }, + "autoload-dev": { + "psr-4": { + "SimPod\\GraphQLUtils\\Tests\\": "tests/" + } + } +} diff --git a/phpcs.xml.dist b/phpcs.xml.dist new file mode 100644 index 0000000..e2eb479 --- /dev/null +++ b/phpcs.xml.dist @@ -0,0 +1,15 @@ + + + + + + + + + + + + src + + + diff --git a/phpstan.neon.dist b/phpstan.neon.dist new file mode 100644 index 0000000..259e55b --- /dev/null +++ b/phpstan.neon.dist @@ -0,0 +1,13 @@ +parameters: + level: max + paths: + - %currentWorkingDirectory%/src + - %currentWorkingDirectory%/tests + tmpDir: %currentWorkingDirectory%/var/phpstan + ignoreErrors: + - "~Method SimPod\\\\GraphQLUtils\\\\Error\\\\FormattedError::createFromException\\(\\) has parameter \\$\\w+ with no typehint specified~" + +includes: + - vendor/phpstan/phpstan-phpunit/extension.neon + - vendor/phpstan/phpstan-phpunit/rules.neon + - vendor/phpstan/phpstan-strict-rules/rules.neon diff --git a/phpunit.xml.dist b/phpunit.xml.dist new file mode 100644 index 0000000..9d5214f --- /dev/null +++ b/phpunit.xml.dist @@ -0,0 +1,32 @@ + + + + + + + tests + + + + + src + + + + + + + + diff --git a/src/Builder/EnumBuilder.php b/src/Builder/EnumBuilder.php new file mode 100644 index 0000000..8db632b --- /dev/null +++ b/src/Builder/EnumBuilder.php @@ -0,0 +1,45 @@ + $value]; + if ($description !== null) { + $enumDefinition['description'] = $description; + } + $this->values[$name ?? $value] = $enumDefinition; + + return $this; + } + + /** + * @return mixed[] + */ + public function build() : array + { + $parameters = parent::build(); + $parameters['values'] = $this->values; + + return $parameters; + } +} diff --git a/src/Builder/FieldBuilder.php b/src/Builder/FieldBuilder.php new file mode 100644 index 0000000..fad74c1 --- /dev/null +++ b/src/Builder/FieldBuilder.php @@ -0,0 +1,64 @@ +parameters['name'] = $name; + $this->parameters['type'] = $type; + } + + public static function create(string $name, Type $type) : self + { + return new self($name, $type); + } + + public function setDescription(string $description) : self + { + $this->parameters['description'] = $description; + + return $this; + } + + public function addArgument(string $name, Type $type, ?string $description = null) : self + { + $this->parameters['args'][$name] = ['type' => $type]; + + if ($description !== null) { + $this->parameters['args'][$name]['description'] = $description; + } + + return $this; + } + + public function setResolver(callable $callback) : self + { + $this->parameters['resolve'] = $callback; + + return $this; + } + + public function setDeprecationReason(string $reason) : self + { + $this->parameters['deprecationReason'] = $reason; + + return $this; + } + + /** + * @return mixed[] + */ + public function build() : array + { + return $this->parameters; + } +} diff --git a/src/Builder/ObjectBuilder.php b/src/Builder/ObjectBuilder.php new file mode 100644 index 0000000..2903c18 --- /dev/null +++ b/src/Builder/ObjectBuilder.php @@ -0,0 +1,37 @@ +fields = $fields; + + return $this; + } + + /** + * @return mixed[] + */ + public function build() : array + { + $parameters = parent::build(); + $parameters['fields'] = $this->fields; + + return $parameters; + } +} diff --git a/src/Builder/TypeBuilder.php b/src/Builder/TypeBuilder.php new file mode 100644 index 0000000..f6bff42 --- /dev/null +++ b/src/Builder/TypeBuilder.php @@ -0,0 +1,64 @@ +name = $name; + } + + /** + * @return static + */ + public function setDescription(string $description) : self + { + $this->description = $description; + + return $this; + } + + /** + * @return static + */ + public function addInterface(InterfaceType $interfaceType) : self + { + $this->interfaces[] = $interfaceType; + + return $this; + } + + /** + * @return mixed[] + */ + public function build() : array + { + return [ + 'name' => $this->name, + 'description' => $this->description, + 'interfaces' => $this->interfaces, + ]; + } +} diff --git a/src/Error/Error.php b/src/Error/Error.php new file mode 100644 index 0000000..0d566a0 --- /dev/null +++ b/src/Error/Error.php @@ -0,0 +1,13 @@ +getPrevious() instanceof Error) { + $type = ['type' => $e->getPrevious()->getType()]; + $arrayError = $type + $arrayError; + } + + return $arrayError; + } +} diff --git a/src/Type/DateTimeType.php b/src/Type/DateTimeType.php new file mode 100644 index 0000000..1e4a5e8 --- /dev/null +++ b/src/Type/DateTimeType.php @@ -0,0 +1,85 @@ + self::NAME, + 'description' => self::DESCRIPTION, + ] + ); + } + + /** + * @param mixed $value + */ + public function serialize($value) : string + { + if (! $value instanceof DateTimeInterface) { + throw new InvariantViolation( + 'DateTime is not an instance of DateTimeImmutable nor DateTime: ' . Utils::printSafe($value) + ); + } + + return $value->format(DateTimeInterface::ATOM); + } + + /** + * @param mixed $value + */ + public function parseValue($value) : DateTimeImmutable + { + $datetime = DateTimeImmutable::createFromFormat(DateTimeInterface::ATOM, $value); + + if ($datetime === false) { + throw new InvalidArgumentException( + sprintf( + 'DateTime type expects input value to be of ATOM format (%s).', + (new DateTimeImmutable())->format(DateTimeInterface::ATOM) + ) + ); + } + + return $datetime; + } + + /** + * @param ValueNode $valueNode + * @param mixed[]|null $variables + * + * @phpcsSuppress SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingParameterTypeHint + */ + public function parseLiteral($valueNode, ?array $variables = null) : ?DateTimeImmutable + { + if (! $valueNode instanceof StringValueNode) { + return null; + } + + return $this->parseValue($valueNode->value); + } +} diff --git a/tests/Builder/EnumBuilderTest.php b/tests/Builder/EnumBuilderTest.php new file mode 100644 index 0000000..1b5e27a --- /dev/null +++ b/tests/Builder/EnumBuilderTest.php @@ -0,0 +1,42 @@ +addValue('Value1', 'EnumName') + ->addValue('Value2', null, 'Value 2 Description') + ->build(); + + self::assertSame($name, $object['name']); + + $values = $object['values']; + + self::assertCount(2, $values); + + self::assertArrayHasKey('EnumName', $values); + self::assertSame('Value1', $values['EnumName']['value']); + + self::assertArrayHasKey('Value2', $values); + self::assertSame('Value 2 Description', $values['Value2']['description']); + } + + public function testInvalidValue() : void + { + $this->expectException(LogicException::class); + + EnumBuilder::createFromName('Enum')->addValue('invalid-value'); + } +} diff --git a/tests/Builder/FieldBuilderTest.php b/tests/Builder/FieldBuilderTest.php new file mode 100644 index 0000000..f4e1663 --- /dev/null +++ b/tests/Builder/FieldBuilderTest.php @@ -0,0 +1,40 @@ +setDeprecationReason('Deprecated') + ->setDescription('SomeDescription') + ->setResolver( + static function () : string{ + return 'Resolver result'; + } + ) + ->addArgument('arg1', Type::int(), 'Argument Description') + ->build(); + + self::assertSame('SomeField', $field['name']); + self::assertSame('Deprecated', $field['deprecationReason']); + self::assertSame('SomeDescription', $field['description']); + + self::assertArrayHasKey('resolve', $field); + self::assertInternalType('callable', $field['resolve']); + self::assertSame('Resolver result', $field['resolve']()); + + self::assertCount(1, $field['args']); + $args = $field['args']; + self::assertArrayHasKey('arg1', $args); + self::assertSame(Type::int(), $args['arg1']['type']); + self::assertSame('Argument Description', $args['arg1']['description']); + } +} diff --git a/tests/Builder/ObjectBuilderTest.php b/tests/Builder/ObjectBuilderTest.php new file mode 100644 index 0000000..c7269ab --- /dev/null +++ b/tests/Builder/ObjectBuilderTest.php @@ -0,0 +1,51 @@ +build()); + } + }; + + $builder = ObjectBuilder::create($name); + $object = $builder + ->setDescription($description) + ->addInterface($interface) + ->setFields([ + FieldBuilder::create('SomeField', Type::string())->build(), + ]) + ->build(); + + self::assertSame($name, $object['name']); + self::assertSame($description, $object['description']); + self::assertArrayHasKey('fields', $object); + self::assertInternalType('array', $object); + self::assertCount(1, $object['fields']); + } + + public function testInvalidName() : void + { + $this->expectException(LogicException::class); + + ObjectBuilder::create('invalid-type-name'); + } +} diff --git a/tests/Error/CustomError.php b/tests/Error/CustomError.php new file mode 100644 index 0000000..78d3139 --- /dev/null +++ b/tests/Error/CustomError.php @@ -0,0 +1,13 @@ + 'Internal server error', + 'category' => 'internal', + ], + FormattedError::createFromException($exception) + ); + } + + public function testDebug() : void + { + $exception = new Exception('When smashing sun-dried shrimps, be sure they are room temperature.'); + + self::assertSame( + [ + 'debugMessage' => 'When smashing sun-dried shrimps, be sure they are room temperature.', + 'message' => 'Internal server error', + 'category' => 'internal', + ], + FormattedError::createFromException($exception, true) + ); + } + + public function testInternalMessageModification() : void + { + $exception = new Exception('When smashing sun-dried shrimps, be sure they are room temperature.'); + + self::assertSame( + [ + 'message' => 'Try grilling smoothie jumbled with salad cream, decorateed with green curry.', + 'category' => 'internal', + ], + FormattedError::createFromException( + $exception, + false, + 'Try grilling smoothie jumbled with salad cream, decorateed with green curry.' + ) + ); + } + + public function testGraphQLCustomError() : void + { + $error = new class extends Error + { + public function __construct() + { + parent::__construct('Error Message', + null, + null, + null, + null, + new CustomError('')); + } + }; + + self::assertSame( + [ + 'type' => 'CUSTOM_ERROR', + 'message' => 'Error Message', + 'category' => 'graphql', + ], + FormattedError::createFromException($error, false) + ); + } +} diff --git a/tests/Type/DateTimeTypeTest.php b/tests/Type/DateTimeTypeTest.php new file mode 100644 index 0000000..7eca782 --- /dev/null +++ b/tests/Type/DateTimeTypeTest.php @@ -0,0 +1,84 @@ +serialize($dateTime); + + self::assertSame($expectedValue, $value); + } + + /** + * @return mixed[][]|Generator + */ + public function dateProviderSerialize() : iterable + { + yield ['2018-12-31T01:02:03+00:00', new DateTime('2018-12-31 01:02:03')]; + yield ['2018-12-31T01:02:03+00:00', new DateTimeImmutable('2018-12-31 01:02:03')]; + } + + /** + * @dataProvider dateProviderSerialize + */ + public function testSerializeInvalidType() : void + { + $this->expectException(InvariantViolation::class); + + $dateTimeType = new DateTimeType(); + $dateTimeType->serialize('non datetimetype'); + } + + public function testParseValue() : void + { + $dateTimeType = new DateTimeType(); + + self::assertEquals( + new DateTimeImmutable('2018-12-31 01:02:03'), + $dateTimeType->parseValue('2018-12-31T01:02:03+00:00') + ); + } + public function testParseValueInvalidFormat() : void + { + $this->expectException(InvalidArgumentException::class); + + $dateTimeType = new DateTimeType(); + $dateTimeType->parseValue('not-datetime string'); + } + + public function testParseLiteral() : void + { + $dateTimeType = new DateTimeType(); + + self::assertEquals( + new DateTimeImmutable('2018-12-31 01:02:03'), + $dateTimeType->parseLiteral(new StringValueNode(['value' => '2018-12-31T01:02:03+00:00'])) + ); + } + + public function testParseLiteralIncompatibleNode() : void + { + $dateTimeType = new DateTimeType(); + + self::assertNull($dateTimeType->parseLiteral(new BooleanValueNode(['value' => false]))); + } +} diff --git a/tests/bootstrap.php b/tests/bootstrap.php new file mode 100644 index 0000000..39f6cba --- /dev/null +++ b/tests/bootstrap.php @@ -0,0 +1,14 @@ +