Skip to content

[PropertyAccess] Fix PropertyAccessorCollectionTest #32690

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 24, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,28 @@ public function getAxes()
}
}

class PropertyAccessorCollectionTest_CarOnlyAdder
{
public function addAxis($axis)
{
}

public function getAxes()
{
}
}

class PropertyAccessorCollectionTest_CarOnlyRemover
{
public function removeAxis($axis)
{
}

public function getAxes()
{
}
}

class PropertyAccessorCollectionTest_CarNoAdderAndRemover
{
public function getAxes()
Expand Down Expand Up @@ -143,25 +165,25 @@ public function testSetValueFailsIfNoAdderNorRemoverFound()

public function testIsWritableReturnsTrueIfAdderAndRemoverExists()
{
$car = $this->getMockBuilder(__CLASS__.'_Car')->getMock();
$car = new PropertyAccessorCollectionTest_Car();
$this->assertTrue($this->propertyAccessor->isWritable($car, 'axes'));
}

public function testIsWritableReturnsFalseIfOnlyAdderExists()
{
$car = $this->getMockBuilder(__CLASS__.'_CarOnlyAdder')->getMock();
$car = new PropertyAccessorCollectionTest_CarOnlyAdder();
$this->assertFalse($this->propertyAccessor->isWritable($car, 'axes'));
}

public function testIsWritableReturnsFalseIfOnlyRemoverExists()
{
$car = $this->getMockBuilder(__CLASS__.'_CarOnlyRemover')->getMock();
$car = new PropertyAccessorCollectionTest_CarOnlyRemover();
$this->assertFalse($this->propertyAccessor->isWritable($car, 'axes'));
}

public function testIsWritableReturnsFalseIfNoAdderNorRemoverExists()
{
$car = $this->getMockBuilder(__CLASS__.'_CarNoAdderAndRemover')->getMock();
$car = new PropertyAccessorCollectionTest_CarNoAdderAndRemover();
$this->assertFalse($this->propertyAccessor->isWritable($car, 'axes'));
}

Expand All @@ -171,7 +193,7 @@ public function testIsWritableReturnsFalseIfNoAdderNorRemoverExists()
*/
public function testSetValueFailsIfAdderAndRemoverExistButValueIsNotTraversable()
{
$car = $this->getMockBuilder(__CLASS__.'_Car')->getMock();
$car = new PropertyAccessorCollectionTest_Car();

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