8000 [PropertyAccess] use data provider for isReadable/isWritable tests · symfony/symfony@f9ddaeb · GitHub
[go: up one dir, main page]

Skip to content

Commit f9ddaeb

Browse files
committed
[PropertyAccess] use data provider for isReadable/isWritable tests
1 parent eabad39 commit f9ddaeb

File tree

1 file changed

+10
-24
lines changed

1 file changed

+10
-24
lines changed

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

Lines changed: 10 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -316,19 +316,12 @@ public function testIsReadableRecognizesMagicCallIfEnabled()
316316
$this->assertTrue($this->propertyAccessor->isReadable(new TestClassMagicCall('Bernhard'), 'magicCallProperty'));
317317
}
318318

319-
public function testIsReadableThrowsExceptionIfNotObjectOrArray()
320-
{
321-
$this->assertFalse($this->propertyAccessor->isReadable('baz', 'foobar'));
322-
}
323-
324-
public function testIsReadableThrowsExceptionIfNull()
325-
{
326-
$this->assertFalse($this->propertyAccessor->isReadable(null, 'foobar'));
327-
}
328-
329-
public function testIsReadableThrowsExceptionIfEmpty()
319+
/**
320+
* @dataProvider getPathsWithUnexpectedType
321+
*/
322+
public function testIsReadableReturnsFalseIfNotObjectOrArray($objectOrArray, $path)
330323
{
331-
$this->assertFalse($this->propertyAccessor->isReadable('', 'foobar'));
324+
$this->assertFalse($this->propertyAccessor->isReadable($objectOrArray, $path));
332325
}
333326

334327
/**
@@ -384,19 +377,12 @@ public function testIsWritableRecognizesMagicCallIfEnabled()
384377
$this->assertTrue($this->propertyAccessor->isWritable(new TestClassMagicCall('Bernhard'), 'magicCallProperty'));
385378
}
386379

387-
public function testNotObjectOrArrayIsNotWritable()
388-
{
389-
$this->assertFalse($this->propertyAccessor->isWritable('baz', 'foobar'));
390-
}
391-
392-
public function testNullIsNotWritable()
393-
{
394-
$this->assertFalse($this->propertyAccessor->isWritable(null, 'foobar'));
395-
}
396-
397-
public function testEmptyIsNotWritable()
380+
/**
381+
* @dataProvider getPathsWithUnexpectedType
382+
*/
383+
public function testIsWritableReturnsFalseIfNotObjectOrArray($objectOrArray, $path)
398384
{
399-
$this->assertFalse($this->propertyAccessor->isWritable('', 'foobar'));
385+
$this->assertFalse($this->propertyAccessor->isWritable($objectOrArray, $path));
400386
}
401387

402388
public function getValidPropertyPaths()

0 commit comments

Comments
 (0)
0