[PropertyAccess] use data provider for isReadable/isWritable tests

This commit is contained in:
Tobias Schultze 2015-02-21 13:54:33 +01:00
parent eabad39dd5
commit f9ddaebe09
1 changed files with 10 additions and 24 deletions

View File

@ -316,19 +316,12 @@ class PropertyAccessorTest extends \PHPUnit_Framework_TestCase
$this->assertTrue($this->propertyAccessor->isReadable(new TestClassMagicCall('Bernhard'), 'magicCallProperty'));
}
public function testIsReadableThrowsExceptionIfNotObjectOrArray()
/**
* @dataProvider getPathsWithUnexpectedType
*/
public function testIsReadableReturnsFalseIfNotObjectOrArray($objectOrArray, $path)
{
$this->assertFalse($this->propertyAccessor->isReadable('baz', 'foobar'));
}
public function testIsReadableThrowsExceptionIfNull()
{
$this->assertFalse($this->propertyAccessor->isReadable(null, 'foobar'));
}
public function testIsReadableThrowsExceptionIfEmpty()
{
$this->assertFalse($this->propertyAccessor->isReadable('', 'foobar'));
$this->assertFalse($this->propertyAccessor->isReadable($objectOrArray, $path));
}
/**
@ -384,19 +377,12 @@ class PropertyAccessorTest extends \PHPUnit_Framework_TestCase
$this->assertTrue($this->propertyAccessor->isWritable(new TestClassMagicCall('Bernhard'), 'magicCallProperty'));
}
public function testNotObjectOrArrayIsNotWritable()
/**
* @dataProvider getPathsWithUnexpectedType
*/
public function testIsWritableReturnsFalseIfNotObjectOrArray($objectOrArray, $path)
{
$this->assertFalse($this->propertyAccessor->isWritable('baz', 'foobar'));
}
public function testNullIsNotWritable()
{
$this->assertFalse($this->propertyAccessor->isWritable(null, 'foobar'));
}
public function testEmptyIsNotWritable()
{
$this->assertFalse($this->propertyAccessor->isWritable('', 'foobar'));
$this->assertFalse($this->propertyAccessor->isWritable($objectOrArray, $path));
}
public function getValidPropertyPaths()