diff --git a/.phpunit.result.cache b/.phpunit.result.cache new file mode 100644 index 0000000..74c267f --- /dev/null +++ b/.phpunit.result.cache @@ -0,0 +1 @@ +C:37:"PHPUnit\Runner\DefaultTestResultCache":1369:{a:2:{s:7:"defects";a:4:{s:93:"TBolier\RethinkQL\UnitTest\Serializer\QueryNormalizerTest::testNormalizeWithCircularReference";i:3;s:107:"TBolier\RethinkQL\UnitTest\Serializer\QueryNormalizerTest::testInvalidArgumentExceptionThrownOnInvalidClass";i:6;s:102:"TBolier\RethinkQL\UnitTest\Serializer\QueryNormalizerTest::testLogicExceptionThrownOnInvalidNormalizer";i:4;s:96:"TBolier\RethinkQL\UnitTest\Serializer\QueryNormalizerTest::testIfDenormalizeThrowsLogicException";i:4;}s:5:"times";a:8:{s:84:"TBolier\RethinkQL\UnitTest\Serializer\QueryNormalizerTest::testNormalizeWithStdClass";d:0.006;s:83:"TBolier\RethinkQL\UnitTest\Serializer\QueryNormalizerTest::testNormalizeWithOptions";d:0.001;s:93:"TBolier\RethinkQL\UnitTest\Serializer\QueryNormalizerTest::testNormalizeWithCircularReference";d:0.001;s:92:"TBolier\RethinkQL\UnitTest\Serializer\QueryNormalizerTest::testNormalizeWithJsonSerializable";d:0.009;s:107:"TBolier\RethinkQL\UnitTest\Serializer\QueryNormalizerTest::testInvalidArgumentExceptionThrownOnInvalidClass";d:0.001;s:102:"TBolier\RethinkQL\UnitTest\Serializer\QueryNormalizerTest::testLogicExceptionThrownOnInvalidNormalizer";d:0.003;s:98:"TBolier\RethinkQL\UnitTest\Serializer\QueryNormalizerTest::testSupportsDenormalizationReturnsFalse";d:0;s:96:"TBolier\RethinkQL\UnitTest\Serializer\QueryNormalizerTest::testIfDenormalizeThrowsLogicException";d:0;}}} \ No newline at end of file diff --git a/.scrutinizer.yml b/.scrutinizer.yml index c264430..3aeb0bd 100644 --- a/.scrutinizer.yml +++ b/.scrutinizer.yml @@ -18,11 +18,13 @@ build: before: - 'source /etc/lsb-release && echo "deb http://download.rethinkdb.com/apt $DISTRIB_CODENAME main" | sudo tee /etc/apt/sources.list.d/rethinkdb.list' - 'wget -qO- https://download.rethinkdb.com/apt/pubkey.gpg | sudo apt-key add -' - - 'sudo apt-get update -y' - - 'sudo apt-get install rethinkdb -y' + - 'sudo apt-get install apt-transport-https ca-certificates -y' + - 'sudo apt-get install libprotobuf8 -f' + - 'wget https://download.rethinkdb.com/apt/pool/trusty/main/r/rethinkdb/rethinkdb_2.3.6~0trusty_amd64.deb' + - 'sudo dpkg --install rethinkdb_2.3.6~0trusty_amd64.deb' - 'sudo cp /etc/rethinkdb/default.conf.sample /etc/rethinkdb/instances.d/instance1.conf' - - 'sudo /etc/init.d/rethinkdb start' - # Overwrites inferred commands + - 'sudo service rethinkdb start' + # Overwrites inferred commands override: [] # Runs after inferred commands after: [] @@ -49,7 +51,7 @@ build_failure_conditions: - 'issues.label("coding-style").new.exists' # No critical issue is present - - 'issues.severity(= MINOR).exists' + # - 'issues.severity(= MINOR).exists' # No new critical issue is introduced (existing ones are tolerated) - 'issues.severity(= MINOR).new.exists' diff --git a/src/Query/Operation/Get.php b/src/Query/Operation/Get.php index 3b3369e..ddb631f 100644 --- a/src/Query/Operation/Get.php +++ b/src/Query/Operation/Get.php @@ -12,6 +12,7 @@ class Get extends AbstractQuery { use ManipulationTrait; + use OperationTrait; /** * @var string|int diff --git a/test/unit/Serializer/QueryNormalizerTest.php b/test/unit/Serializer/QueryNormalizerTest.php deleted file mode 100644 index 6d52454..0000000 --- a/test/unit/Serializer/QueryNormalizerTest.php +++ /dev/null @@ -1,145 +0,0 @@ -normalizer = new QueryNormalizer(); - - $serializer = new Serializer([$this->normalizer]); - - $this->normalizer->setSerializer($serializer); - } - - /** - * @return void - * @throws \Exception - */ - public function testNormalizeWithStdClass(): void - { - $object = new \stdClass(); - $object->foo = 'bar'; - - $data = $this->normalizer->normalize($object); - - $this->assertEquals(['foo' => 'bar'], $data); - } - - /** - * @return void - * @throws \Exception - */ - public function testNormalizeWithOptions(): void - { - $object = new Options(); - $object->setDb('foobar'); - - $expectedObject = new \stdClass(); - $expectedObject->db = [0 => 14, 1 => ['foobar']]; - - $data = $this->normalizer->normalize($object); - - $this->assertEquals($expectedObject, $data); - } - - /** - * @expectedException \Symfony\Component\Serializer\Exception\CircularReferenceException - * @expectedExceptionMessage A circular reference has been detected when serializing the object of class "stdClass" - * (configured limit: 1) - * @return void - */ - public function testNormalizeWithCircularReference(): void - { - $object = new \stdClass(); - $object->foo = 'bar'; - - $context = [ - 'circular_reference_limit' => [ - spl_object_hash($object) => 1, - ], - ]; - - $this->normalizer->normalize($object, null, $context); - } - - /** - * @return void - * @throws \Exception - */ - public function testNormalizeWithJsonSerializable(): void - { - $expectedReturn = ['foo' => 'bar']; - - $object = Mockery::mock('\JsonSerializable'); - $object->shouldReceive('jsonSerialize')->once()->andReturn($expectedReturn); - - - $data = $this->normalizer->normalize($object); - - $this->assertEquals($expectedReturn, $data); - } - - /** - * @expectedException \Symfony\Component\Serializer\Exception\InvalidArgumentException - * @expectedExceptionMessage The ArrayObject must implement "JsonSerializable" - * @return void - */ - public function testInvalidArgumentExceptionThrownOnInvalidClass(): void - { - $object = new \ArrayObject(); - - $this->normalizer->normalize($object); - } - - /** - * @expectedException \Symfony\Component\Serializer\Exception\LogicException - * @expectedExceptionMessage Cannot normalize object because injected serializer is not a normalizer - * @return void - */ - public function testLogicExceptionThrownOnInvalidNormalizer(): void - { - $object = new \stdClass(); - $object->foo = 'bar'; - - $serializerMock = Mockery::mock('\Symfony\Component\Serializer\SerializerInterface'); - $this->normalizer->setSerializer($serializerMock); - - $this->normalizer->normalize($object); - } - - /** - * @return void - * @throws \Exception - */ - public function testSupportsDenormalizationReturnsFalse(): void - { - $this->assertFalse($this->normalizer->supportsDenormalization('foo', 'foo', 'foo')); - } - - /** - * @expectedException \Symfony\Component\Serializer\Exception\LogicException - * @expectedExceptionMessage Cannot denormalize with "TBolier\RethinkQL\Serializer\QueryNormalizer". - * @return void - */ - public function testIfDenormalizeThrowsLogicException(): void - { - $this->normalizer->denormalize('foo', 'bar'); - } -}