Skip to content

Commit 2502a3c

Browse files
Merge branch '5.0'
* 5.0: [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 02e4a10 + 259f265 commit 2502a3c

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('/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\./');
191+
$this->expectExceptionMessageMatches('/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\./');
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
@@ -766,39 +766,39 @@ public function testAdderAndRemoverArePreferredOverSetterForSameSingularAndPlura
766766
public function testAdderWithoutRemover()
767767
{
768768
$this->expectException('Symfony\Component\PropertyAccess\Exception\NoSuchPropertyException');
769-
$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\./');
769+
$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\./');
770770
$object = new TestAdderRemoverInvalidMethods();
771771
$this->propertyAccessor->setValue($object, 'foos', [1, 2]);
772772
}
773773

774774
public function testRemoverWithoutAdder()
775775
{
776776
$this->expectException('Symfony\Component\PropertyAccess\Exception\NoSuchPropertyException');
777-
$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\./');
777+
$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\./');
778778
$object = new TestAdderRemoverInvalidMethods();
779779
$this->propertyAccessor->setValue($object, 'bars', [1, 2]);
780780
}
781781

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

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

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

0 commit comments

Comments
 (0)