From 9e2e8ab1c94e937f35378bdb5e291817941157fb Mon Sep 17 00:00:00 2001 From: Jeremy Mikola Date: Fri, 12 Jul 2013 17:32:33 -0400 Subject: [PATCH 1/2] Fix missing getter for private field test for PropertyAccess 2.3+ See: https://github.com/symfony/PropertyAccess/commit/df67239b02a9cef12cf84579f6cf569680298238 --- .../ModelToElasticaAutoTransformerTest.php | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/Tests/Transformer/ModelToElasticaAutoTransformerTest.php b/Tests/Transformer/ModelToElasticaAutoTransformerTest.php index 798ea38..daa6512 100644 --- a/Tests/Transformer/ModelToElasticaAutoTransformerTest.php +++ b/Tests/Transformer/ModelToElasticaAutoTransformerTest.php @@ -203,10 +203,17 @@ class ModelToElasticaAutoTransformerTest extends \PHPUnit_Framework_TestCase public function testThatCannotTransformObjectWhenGetterDoesNotExistForPrivateMethod() { - // Support both Symfony 2.1 (Form component) and 2.2 (PropertyAccess component) - $expectedException = class_exists('Symfony\Component\PropertyAccess\PropertyAccess') - ? 'Symfony\Component\PropertyAccess\Exception\PropertyAccessDeniedException' - : 'Symfony\Component\Form\Exception\PropertyAccessDeniedException'; + // Support both Symfony 2.1 (Form component) and 2.2+ (PropertyAccess component) + if (class_exists('Symfony\Component\PropertyAccess\PropertyAccess')) { + /* ProperyAccess 2.3+ removed PropertyAccessDeniedException, so we + * must expect NoSuchPropertyException in its absence. + */ + $expectedException = class_exists('Symfony\Component\Form\Exception\PropertyAccessDeniedException') + ? 'Symfony\Component\Form\Exception\PropertyAccessDeniedException' + : 'Symfony\Component\PropertyAccess\Exception\NoSuchPropertyException'; + } else { + $expectedException = 'Symfony\Component\Form\Exception\PropertyAccessDeniedException'; + } $this->setExpectedException($expectedException); From ab0c27c4819bba166511bde3705861ca68001717 Mon Sep 17 00:00:00 2001 From: Jeremy Mikola Date: Wed, 17 Jul 2013 15:53:32 -0400 Subject: [PATCH 2/2] Fix expected exception class (related to #338) This corrects a typo in a66a37aebd7424e9a82e81bd1a3760abb735ea7e. --- Tests/Transformer/ModelToElasticaAutoTransformerTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Tests/Transformer/ModelToElasticaAutoTransformerTest.php b/Tests/Transformer/ModelToElasticaAutoTransformerTest.php index daa6512..cb980da 100644 --- a/Tests/Transformer/ModelToElasticaAutoTransformerTest.php +++ b/Tests/Transformer/ModelToElasticaAutoTransformerTest.php @@ -208,8 +208,8 @@ class ModelToElasticaAutoTransformerTest extends \PHPUnit_Framework_TestCase /* ProperyAccess 2.3+ removed PropertyAccessDeniedException, so we * must expect NoSuchPropertyException in its absence. */ - $expectedException = class_exists('Symfony\Component\Form\Exception\PropertyAccessDeniedException') - ? 'Symfony\Component\Form\Exception\PropertyAccessDeniedException' + $expectedException = class_exists('Symfony\Component\PropertyAccess\Exception\PropertyAccessDeniedException') + ? 'Symfony\Component\PropertyAccess\Exception\PropertyAccessDeniedException' : 'Symfony\Component\PropertyAccess\Exception\NoSuchPropertyException'; } else { $expectedException = 'Symfony\Component\Form\Exception\PropertyAccessDeniedException';