class PluginBaseTest in Zircon Profile 8
Same name in this branch
- 8 core/tests/Drupal/Tests/Component/Plugin/PluginBaseTest.php \Drupal\Tests\Component\Plugin\PluginBaseTest
- 8 core/modules/views/tests/src/Unit/PluginBaseTest.php \Drupal\Tests\views\Unit\PluginBaseTest
- 8 core/modules/views/src/Tests/Plugin/PluginBaseTest.php \Drupal\views\Tests\Plugin\PluginBaseTest
Same name and namespace in other branches
- 8.0 core/tests/Drupal/Tests/Component/Plugin/PluginBaseTest.php \Drupal\Tests\Component\Plugin\PluginBaseTest
@coversDefaultClass \Drupal\Component\Plugin\PluginBase @group Plugin
Hierarchy
- class \Drupal\Tests\UnitTestCase extends \Drupal\Tests\PHPUnit_Framework_TestCase
- class \Drupal\Tests\Component\Plugin\PluginBaseTest
Expanded class hierarchy of PluginBaseTest
File
- core/
tests/ Drupal/ Tests/ Component/ Plugin/ PluginBaseTest.php, line 16 - Contains \Drupal\Tests\Component\Plugin\PluginBaseTest.
Namespace
Drupal\Tests\Component\PluginView source
class PluginBaseTest extends UnitTestCase {
/**
* @dataProvider providerTestGetPluginId
* @covers ::getPluginId
*/
public function testGetPluginId($plugin_id, $expected) {
$plugin_base = $this
->getMockForAbstractClass('Drupal\\Component\\Plugin\\PluginBase', array(
array(),
$plugin_id,
array(),
));
$this
->assertEquals($expected, $plugin_base
->getPluginId());
}
/**
* Returns test data for testGetPluginId().
*
* @return array
*/
public function providerTestGetPluginId() {
return array(
array(
'base_id',
'base_id',
),
array(
'base_id:derivative',
'base_id:derivative',
),
);
}
/**
* @dataProvider providerTestGetBaseId
* @coves ::getBaseId
*/
public function testGetBaseId($plugin_id, $expected) {
/** @var \Drupal\Component\Plugin\PluginBase|\PHPUnit_Framework_MockObject_MockObject $plugin_base */
$plugin_base = $this
->getMockForAbstractClass('Drupal\\Component\\Plugin\\PluginBase', array(
array(),
$plugin_id,
array(),
));
$this
->assertEquals($expected, $plugin_base
->getBaseId());
}
/**
* Returns test data for testGetBaseId().
*
* @return array
*/
public function providerTestGetBaseId() {
return array(
array(
'base_id',
'base_id',
),
array(
'base_id:derivative',
'base_id',
),
);
}
/**
* @dataProvider providerTestGetDerivativeId
* @covers ::getDerivativeId
*/
public function testGetDerivativeId($plugin_id = NULL, $expected = NULL) {
/** @var \Drupal\Component\Plugin\PluginBase|\PHPUnit_Framework_MockObject_MockObject $plugin_base */
$plugin_base = $this
->getMockForAbstractClass('Drupal\\Component\\Plugin\\PluginBase', array(
array(),
$plugin_id,
array(),
));
$this
->assertEquals($expected, $plugin_base
->getDerivativeId());
}
/**
* Returns test data for testGetDerivativeId().
*
* @return array
*/
public function providerTestGetDerivativeId() {
return array(
array(
'base_id',
NULL,
),
array(
'base_id:derivative',
'derivative',
),
);
}
/**
* @covers ::getPluginDefinition
*/
public function testGetPluginDefinition() {
$plugin_base = $this
->getMockForAbstractClass('Drupal\\Component\\Plugin\\PluginBase', array(
array(),
'plugin_id',
array(
'value',
array(
'key' => 'value',
),
),
));
$this
->assertEquals(array(
'value',
array(
'key' => 'value',
),
), $plugin_base
->getPluginDefinition());
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
PluginBaseTest:: |
public | function | Returns test data for testGetBaseId(). | |
PluginBaseTest:: |
public | function | Returns test data for testGetDerivativeId(). | |
PluginBaseTest:: |
public | function | Returns test data for testGetPluginId(). | |
PluginBaseTest:: |
public | function | @dataProvider providerTestGetBaseId @coves ::getBaseId | |
PluginBaseTest:: |
public | function | @dataProvider providerTestGetDerivativeId @covers ::getDerivativeId | |
PluginBaseTest:: |
public | function | @covers ::getPluginDefinition | |
PluginBaseTest:: |
public | function | @dataProvider providerTestGetPluginId @covers ::getPluginId | |
UnitTestCase:: |
protected | property | The random generator. | |
UnitTestCase:: |
protected | property | The app root. | |
UnitTestCase:: |
protected | function | Asserts if two arrays are equal by sorting them first. | |
UnitTestCase:: |
protected | function | Mocks a block with a block plugin. | |
UnitTestCase:: |
protected | function | Returns a stub class resolver. | |
UnitTestCase:: |
public | function | Returns a stub config factory that behaves according to the passed in array. | |
UnitTestCase:: |
public | function | Returns a stub config storage that returns the supplied configuration. | |
UnitTestCase:: |
protected | function | Sets up a container with a cache tags invalidator. | |
UnitTestCase:: |
protected | function | Gets the random generator for the utility methods. | |
UnitTestCase:: |
public | function | Returns a stub translation manager that just returns the passed string. | |
UnitTestCase:: |
public | function | Generates a unique random string containing letters and numbers. | |
UnitTestCase:: |
protected | function | 259 |