protected function ChainEntityResolverTest::createEntityResolverMock in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/serialization/tests/src/Unit/EntityResolver/ChainEntityResolverTest.php \Drupal\Tests\serialization\Unit\EntityResolver\ChainEntityResolverTest::createEntityResolverMock()
Creates a mock entity resolver.
Parameters
null|int $return: Whether the mocked resolve method should return TRUE or FALSE.
bool $called: Whether or not the resolve method is expected to be called.
Return value
\Drupal\serialization\EntityResolver\EntityResolverInterface|\PHPUnit_Framework_MockObject_MockObject The mocked entity resolver.
5 calls to ChainEntityResolverTest::createEntityResolverMock()
- ChainEntityResolverTest::testResolverWithFirstResolved in core/
modules/ serialization/ tests/ src/ Unit/ EntityResolver/ ChainEntityResolverTest.php - Test the resolve method with a matching resolver first.
- ChainEntityResolverTest::testResolverWithLastResolved in core/
modules/ serialization/ tests/ src/ Unit/ EntityResolver/ ChainEntityResolverTest.php - Test the resolve method with a matching resolver last.
- ChainEntityResolverTest::testResolverWithNoneResolved in core/
modules/ serialization/ tests/ src/ Unit/ EntityResolver/ ChainEntityResolverTest.php - Test the resolve method with no matching resolvers.
- ChainEntityResolverTest::testResolverWithNoneResolvedUsingAddResolver in core/
modules/ serialization/ tests/ src/ Unit/ EntityResolver/ ChainEntityResolverTest.php - Test the resolve method with no matching resolvers, using addResolver.
- ChainEntityResolverTest::testResolverWithResolvedToZero in core/
modules/ serialization/ tests/ src/ Unit/ EntityResolver/ ChainEntityResolverTest.php - Test the resolve method where one resolver returns 0.
File
- core/
modules/ serialization/ tests/ src/ Unit/ EntityResolver/ ChainEntityResolverTest.php, line 142 - Contains \Drupal\Tests\serialization\Unit\EntityResolver\ChainEntityResolverTest.
Class
- ChainEntityResolverTest
- @coversDefaultClass \Drupal\serialization\EntityResolver\ChainEntityResolver @group serialization
Namespace
Drupal\Tests\serialization\Unit\EntityResolverCode
protected function createEntityResolverMock($return = NULL, $called = TRUE) {
$mock = $this
->getMock('Drupal\\serialization\\EntityResolver\\EntityResolverInterface');
if ($called) {
$mock
->expects($this
->once())
->method('resolve')
->with($this->testNormalizer, $this->testData, $this->testEntityType)
->will($this
->returnValue($return));
}
else {
$mock
->expects($this
->never())
->method('resolve');
}
return $mock;
}