Skip to content

Commit eab5d4f

Browse files
committed
minor symfony#32690 [PropertyAccess] Fix PropertyAccessorCollectionTest (fancyweb)
This PR was merged into the 3.4 branch. Discussion ---------- [PropertyAccess] Fix PropertyAccessorCollectionTest | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - In symfony#32627, I (a script actually) removed 2 fixtures classes from this test class. They are actually used but by tests that don't fail without them 😁 (because they were mocked and it's possible to mock non existing classes). This PR restores those 2 classes and remove the unneeded mocks so the tests use the real classes and are actually useful. Commits ------- a310bac [PropertyAccess] Fix PropertyAccessorCollectionTest
2 parents a2da86a + a310bac commit eab5d4f

File tree

1 file changed

+27
-5
lines changed

1 file changed

+27
-5
lines changed

src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorCollectionTest.php

+27-5
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,28 @@ public function getAxes()
4343
}
4444
}
4545

46+
class PropertyAccessorCollectionTest_CarOnlyAdder
47+
{
48+
public function addAxis($axis)
49+
{
50+
}
51+
52+
public function getAxes()
53+
{
54+
}
55+
}
56+
57+
class PropertyAccessorCollectionTest_CarOnlyRemover
58+
{
59+
public function removeAxis($axis)
60+
{
61+
}
62+
63+
public function getAxes()
64+
{
65+
}
66+
}
67+
4668
class PropertyAccessorCollectionTest_CarNoAdderAndRemover
4769
{
4870
public function getAxes()
@@ -143,25 +165,25 @@ public function testSetValueFailsIfNoAdderNorRemoverFound()
143165

144166
public function testIsWritableReturnsTrueIfAdderAndRemoverExists()
145167
{
146-
$car = $this->getMockBuilder(__CLASS__.'_Car')->getMock();
168+
$car = new PropertyAccessorCollectionTest_Car();
147169
$this->assertTrue($this->propertyAccessor->isWritable($car, 'axes'));
148170
}
149171

150172
public function testIsWritableReturnsFalseIfOnlyAdderExists()
151173
{
152-
$car = $this->getMockBuilder(__CLASS__.'_CarOnlyAdder')->getMock();
174+
$car = new PropertyAccessorCollectionTest_CarOnlyAdder();
153175
$this->assertFalse($this->propertyAccessor->isWritable($car, 'axes'));
154176
}
155177

156178
public function testIsWritableReturnsFalseIfOnlyRemoverExists()
157179
{
158-
$car = $this->getMockBuilder(__CLASS__.'_CarOnlyRemover')->getMock();
180+
$car = new PropertyAccessorCollectionTest_CarOnlyRemover();
159181
$this->assertFalse($this->propertyAccessor->isWritable($car, 'axes'));
160182
}
161183

162184
public function testIsWritableReturnsFalseIfNoAdderNorRemoverExists()
163185
{
164-
$car = $this->getMockBuilder(__CLASS__.'_CarNoAdderAndRemover')->getMock();
186+
$car = new PropertyAccessorCollectionTest_CarNoAdderAndRemover();
165187
$this->assertFalse($this->propertyAccessor->isWritable($car, 'axes'));
166188
}
167189

@@ -171,7 +193,7 @@ public function testIsWritableReturnsFalseIfNoAdderNorRemoverExists()
171193
*/
172194
public function testSetValueFailsIfAdderAndRemoverExistButValueIsNotTraversable()
173195
{
174-
$car = $this->getMockBuilder(__CLASS__.'_Car')->getMock();
196+
$car = new PropertyAccessorCollectionTest_Car();
175197

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

0 commit comments

Comments
 (0)