Skip to content

Commit 259f265

Browse files
Merge branch '4.4' into 5.0
* 4.4: [PhpUnitBridge] add PolyfillTestCaseTrait::expectExceptionMessageMatches to provide FC with recent phpunit versions [Messenger] Make sure redis transports are initialized correctly Remove return type for Twig function workflow_metadata() [DI] fix typo
2 parents b93c1d8 + f6a51bd commit 259f265

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

Tests/PropertyAccessorCollectionTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ public function testSetValueCallsAdderAndRemoverForNestedCollections()
149149
public function testSetValueFailsIfNoAdderNorRemoverFound()
150150
{
151151
$this->expectException('Symfony\Component\PropertyAccess\Exception\NoSuchPropertyException');
152-
$this->expectExceptionMessageRegExp('/Could not determine access type for property "axes" in class "Mock_PropertyAccessorCollectionTest_CarNoAdderAndRemover_[^"]*"./');
152+
$this->expectExceptionMessageMatches('/Could not determine access type for property "axes" in class "Mock_PropertyAccessorCollectionTest_CarNoAdderAndRemover_[^"]*"./');
153153
$car = $this->getMockBuilder(__CLASS__.'_CarNoAdderAndRemover')->getMock();
154154
$axesBefore = $this->getContainer([1 => 'second', 3 => 'fourth']);
155155
$axesAfter = $this->getContainer([0 => 'first', 1 => 'second', 2 => 'third']);
@@ -188,7 +188,7 @@ public function testIsWritableReturnsFalseIfNoAdderNorRemoverExists()
188188
public function testSetValueFailsIfAdderAndRemoverExistButValueIsNotTraversable()
189189
{
190190
$this->expectException('Symfony\Component\PropertyAccess\Exception\NoSuchPropertyException');
191-
$this->expectExceptionMessageRegExp('/Could not determine access type for property "axes" in class "Symfony\\\\Component\\\\PropertyAccess\\\\Tests\\\\PropertyAccessorCollectionTest_Car[^"]*": The property "axes" in class "Symfony\\\\Component\\\\PropertyAccess\\\\Tests\\\\PropertyAccessorCollectionTest_Car[^"]*" can be defined with the methods "addAxis\(\)", "removeAxis\(\)" but the new value must be an array or an instance of \\\\Traversable, "string" given./');
191+
$this->expectExceptionMessageMatches('/Could not determine access type for property "axes" in class "Symfony\\\\Component\\\\PropertyAccess\\\\Tests\\\\PropertyAccessorCollectionTest_Car[^"]*": The property "axes" in class "Symfony\\\\Component\\\\PropertyAccess\\\\Tests\\\\PropertyAccessorCollectionTest_Car[^"]*" can be defined with the methods "addAxis\(\)", "removeAxis\(\)" but the new value must be an array or an instance of \\\\Traversable, "string" given./');
192192
$car = new PropertyAccessorCollectionTest_Car();
193193

194194
$this->propertyAccessor->setValue($car, 'axes', 'Not an array or Traversable');

Tests/PropertyAccessorTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -768,39 +768,39 @@ public function testAdderAndRemoverArePreferredOverSetterForSameSingularAndPlura
768768
public function testAdderWithoutRemover()
769769
{
770770
$this->expectException('Symfony\Component\PropertyAccess\Exception\NoSuchPropertyException');
771-
$this->expectExceptionMessageRegExp('/.*The add method "addFoo" in class "Symfony\\\Component\\\PropertyAccess\\\Tests\\\Fixtures\\\TestAdderRemoverInvalidMethods" was found, but the corresponding remove method "removeFoo" was not found\./');
771+
$this->expectExceptionMessageMatches('/.*The add method "addFoo" in class "Symfony\\\Component\\\PropertyAccess\\\Tests\\\Fixtures\\\TestAdderRemoverInvalidMethods" was found, but the corresponding remove method "removeFoo" was not found\./');
772772
$object = new TestAdderRemoverInvalidMethods();
773773
$this->propertyAccessor->setValue($object, 'foos', [1, 2]);
774774
}
775775

776776
public function testRemoverWithoutAdder()
777777
{
778778
$this->expectException('Symfony\Component\PropertyAccess\Exception\NoSuchPropertyException');
779-
$this->expectExceptionMessageRegExp('/.*The remove method "removeBar" in class "Symfony\\\Component\\\PropertyAccess\\\Tests\\\Fixtures\\\TestAdderRemoverInvalidMethods" was found, but the corresponding add method "addBar" was not found\./');
779+
$this->expectExceptionMessageMatches('/.*The remove method "removeBar" in class "Symfony\\\Component\\\PropertyAccess\\\Tests\\\Fixtures\\\TestAdderRemoverInvalidMethods" was found, but the corresponding add method "addBar" was not found\./');
780780
$object = new TestAdderRemoverInvalidMethods();
781781
$this->propertyAccessor->setValue($object, 'bars', [1, 2]);
782782
}
783783

784784
public function testAdderAndRemoveNeedsTheExactParametersDefined()
785785
{
786786
$this->expectException('Symfony\Component\PropertyAccess\Exception\NoSuchPropertyException');
787-
$this->expectExceptionMessageRegExp('/.*The method "addFoo" in class "Symfony\\\Component\\\PropertyAccess\\\Tests\\\Fixtures\\\TestAdderRemoverInvalidArgumentLength" requires 0 arguments, but should accept only 1\. The method "removeFoo" in class "Symfony\\\Component\\\PropertyAccess\\\Tests\\\Fixtures\\\TestAdderRemoverInvalidArgumentLength" requires 2 arguments, but should accept only 1\./');
787+
$this->expectExceptionMessageMatches('/.*The method "addFoo" in class "Symfony\\\Component\\\PropertyAccess\\\Tests\\\Fixtures\\\TestAdderRemoverInvalidArgumentLength" requires 0 arguments, but should accept only 1\. The method "removeFoo" in class "Symfony\\\Component\\\PropertyAccess\\\Tests\\\Fixtures\\\TestAdderRemoverInvalidArgumentLength" requires 2 arguments, but should accept only 1\./');
788788
$object = new TestAdderRemoverInvalidArgumentLength();
789789
$this->propertyAccessor->setValue($object, 'foo', [1, 2]);
790790
}
791791

792792
public function testSetterNeedsTheExactParametersDefined()
793793
{
794794
$this->expectException('Symfony\Component\PropertyAccess\Exception\NoSuchPropertyException');
795-
$this->expectExceptionMessageRegExp('/.*The method "setBar" in class "Symfony\\\Component\\\PropertyAccess\\\Tests\\\Fixtures\\\TestAdderRemoverInvalidArgumentLength" requires 2 arguments, but should accept only 1\./');
795+
$this->expectExceptionMessageMatches('/.*The method "setBar" in class "Symfony\\\Component\\\PropertyAccess\\\Tests\\\Fixtures\\\TestAdderRemoverInvalidArgumentLength" requires 2 arguments, but should accept only 1\./');
796796
$object = new TestAdderRemoverInvalidArgumentLength();
797797
$this->propertyAccessor->setValue($object, 'bar', [1, 2]);
798798
}
799799

800800
public function testSetterNeedsPublicAccess()
801801
{
802802
$this->expectException('Symfony\Component\PropertyAccess\Exception\NoSuchPropertyException');
803-
$this->expectExceptionMessageRegExp('/.*The method "setFoo" in class "Symfony\\\Component\\\PropertyAccess\\\Tests\\\Fixtures\\\TestClassSetValue" was found but does not have public access./');
803+
$this->expectExceptionMessageMatches('/.*The method "setFoo" in class "Symfony\\\Component\\\PropertyAccess\\\Tests\\\Fixtures\\\TestClassSetValue" was found but does not have public access./');
804804
$object = new TestClassSetValue(0);
805805
$this->propertyAccessor->setValue($object, 'foo', 1);
806806
}

0 commit comments

Comments
 (0)