protected function UnitTestBase::getMockForAbstractClassWithMethods in Select (or other) 8
Same name and namespace in other branches
- 4.x tests/src/Unit/UnitTestBase.php \Drupal\Tests\select_or_other\Unit\UnitTestBase::getMockForAbstractClassWithMethods()
Creates a mock for an abstract class with some mapped methods.
Parameters
string $abstractClassName:
array $methods:
Return value
\PHPUnit_Framework_MockObject_MockObject
4 calls to UnitTestBase::getMockForAbstractClassWithMethods()
- ListWidgetTest::massageFormValuesAddsNewValuesToAllowedValues in tests/
src/ Unit/ ListWidgetTest.php - @test @covers Drupal\select_or_other\Plugin\Field\FieldWidget\ListWidget::extractNewValues @covers Drupal\select_or_other\Plugin\Field\FieldWidget\ListWidget::AddNewValuesToAllowedValues
- ListWidgetTest::massageFormValuesDoNotAddOtherValuesToAllowedValues in tests/
src/ Unit/ ListWidgetTest.php - @test @covers Drupal\select_or_other\Plugin\Field\FieldWidget\ListWidget::extractNewValues @covers Drupal\select_or_other\Plugin\Field\FieldWidget\ListWidget::AddNewValuesToAllowedValues
- UnitTestBase::getBasicMocks in tests/
src/ Unit/ UnitTestBase.php - Creates and returns two basic mocks.
- UnitTestBase::getNewEntityTypeManagerMock in tests/
src/ Unit/ UnitTestBase.php
File
- tests/
src/ Unit/ UnitTestBase.php, line 132
Class
Namespace
Drupal\Tests\select_or_other\UnitCode
protected function getMockForAbstractClassWithMethods($abstractClassName, array $methods) {
$mock = $this
->getMockForAbstractClass($abstractClassName);
foreach ($methods as $method => $return_value) {
$mock
->method($method)
->willReturn($return_value);
}
return $mock;
}