drupalci.yml | 36 ++++++++++++++++++++++++++++++++++++ src/Serializer/Serializer.php | 22 +++++++++++----------- 2 files changed, 47 insertions(+), 11 deletions(-) diff --git a/drupalci.yml b/drupalci.yml new file mode 100644 index 0000000..d0c0d39 --- /dev/null +++ b/drupalci.yml @@ -0,0 +1,36 @@ +# This is the DrupalCI testbot build file for JSON API. +# Learn to make one for your own drupal.org project: +# https://www.drupal.org/drupalorg/docs/drupal-ci/customizing-drupalci-testing +build: + assessment: + validate_codebase: + phplint: + # Re-run composer install to ensure the dependencies resolve for the + # containerized PHP version. + container_composer: + options: ' install --prefer-dist --no-suggest --no-progress --no-interaction' + halt-on-fail: true + phpcs: + # phpcs will use core's specified version of Coder. + sniff-all-files: false + halt-on-fail: false + testing: + # run_tests task is executed several times in order of performance speeds. + # halt-on-fail can be set on the run_tests tasks in order to fail fast. + # suppress-deprecations is false in order to be alerted to usages of + # deprecated code. + run_tests.phpunit: + types: 'PHPUnit-Unit' + testgroups: '--all' + suppress-deprecations: false + halt-on-fail: false + run_tests.kernel: + types: 'PHPUnit-Kernel' + testgroups: '--all' + suppress-deprecations: false + halt-on-fail: false + run_tests.functional: + types: 'PHPUnit-Functional' + testgroups: '--all' + suppress-deprecations: false + halt-on-fail: false diff --git a/src/Serializer/Serializer.php b/src/Serializer/Serializer.php index 4c4b56b..dae087c 100644 --- a/src/Serializer/Serializer.php +++ b/src/Serializer/Serializer.php @@ -42,10 +42,10 @@ final class Serializer extends SymfonySerializer { * {@inheritdoc} */ public function normalize($data, $format = NULL, array $context = []) { - if ($this->selfSupportsNormalization($data, $format)) { + if ($this->selfSupportsNormalization($data, $format, $context)) { return parent::normalize($data, $format, $context); } - if ($this->fallbackNormalizer->supportsNormalization($data, $format)) { + if ($this->fallbackNormalizer->supportsNormalization($data, $format, $context)) { return $this->fallbackNormalizer->normalize($data, $format, $context); } return parent::normalize($data, $format, $context); @@ -55,7 +55,7 @@ final class Serializer extends SymfonySerializer { * {@inheritdoc} */ public function denormalize($data, $type, $format = NULL, array $context = []) { - if ($this->selfSupportsDenormalization($data, $type, $format)) { + if ($this->selfSupportsDenormalization($data, $type, $format, $context)) { return parent::denormalize($data, $type, $format, $context); } return $this->fallbackNormalizer->denormalize($data, $type, $format, $context); @@ -64,8 +64,8 @@ final class Serializer extends SymfonySerializer { /** * {@inheritdoc} */ - public function supportsNormalization($data, $format = NULL) { - return $this->selfSupportsNormalization($data, $format) || $this->fallbackNormalizer->supportsNormalization($data, $format); + public function supportsNormalization($data, $format = NULL, $context = []) { + return $this->selfSupportsNormalization($data, $format, $context) || $this->fallbackNormalizer->supportsNormalization($data, $format, $context); } /** @@ -79,15 +79,15 @@ final class Serializer extends SymfonySerializer { * @return bool * Whether this class supports normalization for the given data. */ - private function selfSupportsNormalization($data, $format = NULL) { - return parent::supportsNormalization($data, $format); + private function selfSupportsNormalization($data, $format = NULL, $context = []) { + return parent::supportsNormalization($data, $format, $context); } /** * {@inheritdoc} */ - public function supportsDenormalization($data, $type, $format = NULL) { - return $this->selfSupportsDenormalization($data, $type, $format) || $this->fallbackNormalizer->supportsDenormalization($data, $type, $format); + public function supportsDenormalization($data, $type, $format = NULL, $context = []) { + return $this->selfSupportsDenormalization($data, $type, $format, $context) || $this->fallbackNormalizer->supportsDenormalization($data, $type, $format, $context); } /** @@ -103,8 +103,8 @@ final class Serializer extends SymfonySerializer { * @return bool * Whether this class supports normalization for the given data and type. */ - private function selfSupportsDenormalization($data, $type, $format = NULL) { - return parent::supportsDenormalization($data, $type, $format); + private function selfSupportsDenormalization($data, $type, $format = NULL, $context = []) { + return parent::supportsDenormalization($data, $type, $format, $context); } }