Skip to content

Commit

Permalink
[PropertyAccess] use data provider for isReadable/isWritable tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Tobion committed Feb 21, 2015
1 parent eabad39 commit f9ddaeb
Showing 1 changed file with 10 additions and 24 deletions.
34 changes: 10 additions & 24 deletions src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorTest.php
Expand Up @@ -316,19 +316,12 @@ public function testIsReadableRecognizesMagicCallIfEnabled()
$this->assertTrue($this->propertyAccessor->isReadable(new TestClassMagicCall('Bernhard'), 'magicCallProperty'));
}

public function testIsReadableThrowsExceptionIfNotObjectOrArray()
{
$this->assertFalse($this->propertyAccessor->isReadable('baz', 'foobar'));
}

public function testIsReadableThrowsExceptionIfNull()
{
$this->assertFalse($this->propertyAccessor->isReadable(null, 'foobar'));
}

public function testIsReadableThrowsExceptionIfEmpty()
/**
* @dataProvider getPathsWithUnexpectedType
*/
public function testIsReadableReturnsFalseIfNotObjectOrArray($objectOrArray, $path)
{
$this->assertFalse($this->propertyAccessor->isReadable('', 'foobar'));
$this->assertFalse($this->propertyAccessor->isReadable($objectOrArray, $path));
}

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

public function testNotObjectOrArrayIsNotWritable()
{
$this->assertFalse($this->propertyAccessor->isWritable('baz', 'foobar'));
}

public function testNullIsNotWritable()
{
$this->assertFalse($this->propertyAccessor->isWritable(null, 'foobar'));
}

public function testEmptyIsNotWritable()
/**
* @dataProvider getPathsWithUnexpectedType
*/
public function testIsWritableReturnsFalseIfNotObjectOrArray($objectOrArray, $path)
{
$this->assertFalse($this->propertyAccessor->isWritable('', 'foobar'));
$this->assertFalse($this->propertyAccessor->isWritable($objectOrArray, $path));
}

public function getValidPropertyPaths()
Expand Down

0 comments on commit f9ddaeb

Please sign in to comment.