public function ServiceContainerCToolsIntegrationTest::testCToolsPlugin in Service Container 7
Same name and namespace in other branches
- 7.2 lib/Drupal/service_container/Tests/ServiceContainerCToolsIntegrationTest.php \Drupal\service_container\Tests\ServiceContainerCToolsIntegrationTest::testCToolsPlugin()
Tests if a particular CTools plugin is available.
File
- lib/
Drupal/ service_container/ Tests/ ServiceContainerCToolsIntegrationTest.php, line 57 - Contains \Drupal\service_container\Tests\ServiceContainerCToolsIntegrationTest.
Class
Namespace
Drupal\service_container\TestsCode
public function testCToolsPlugin() {
$service = \Drupal::service('service_container_test_ctools.ServiceContainerTestCtoolsPlugin')
->createInstance('ServiceContainerTestCtoolsPluginTest1');
$this
->assertEqual($service
->beep(), 'beep!');
try {
$service = \Drupal::service('service_container_test_ctools.yolo')
->createInstance('yolo1');
} catch (\Exception $e) {
$this
->pass('Non-existant plugin does not exist in the container.');
}
// @todo Test and fix instantiating non-class plugins.
}