It turns out that there is a new requirement for writing test classes, namely,
Your test class needs a phpDoc comment block with a description and a @group annotation, which gives information about the test.So, for example, by adding @group in the following comment block, the test class was recognized and listed under the Optimizely grouping. The lead paragraph of the comment block is treated as a description and is displayed accordingly in the listing.
/**
* Create users with no, some, and optimizely permissions
* to test access to module related pages.
*
* @group Optimizely
*/
class OptimizelyAccessTest extends WebTestBase { . . . . }
This @group annotation seems to have been created specifically for the Testing module and is not part of the general documentation standards.
Sources:
Automated tests
https://api.drupal.org/api/drupal/core!modules!system!core.api.php/group/testing/8
API documentation and comment standards
https://www.drupal.org/coding-standards/docs
Fatal error: Call to undefined function Drupal\optimizely\Tests\module_invoke()
Function module_invoke() has been removed. I replaced this call,
$schema = module_invoke('optimizely', 'schema');
with this one.
$schema = \Drupal::moduleHandler()
->invoke('optimizely', 'schema');
Generally speaking, interface ModuleHandlerInterface and class ModuleHandler provide the functionality that was previously in functions such as this one as well as module_list() and module_implements() which have also been removed.
Sources:
Remove bootstrap.inc module_invoke()
https://www.drupal.org/node/2330181
Module/hook system functions replaced with module_handler and module_installer
https://www.drupal.org/node/1894902
Running drush on a freshly-installed Beta 9 site gave the error message,
Drupal\Core\DependencyInjection\ContainerNotInitializedException: \Drupal::$container is not initialized yet. \Drupal::setContainer() must be called with a real container. in Drupal::getContainer() (line 129 of /var/www/html/opti/core/lib/Drupal.php).
I was using a version of drush 7 from January. Downloading and installing the current drush 7.0-dev fixed this problem.
Sources:
Installing Drush for Drupal 8
http://optimizely-to-drupal-8.blogspot.com/2015/01/installing-drush-for-drupal-8.html
Drupal Version : 8.0.x-dev - 2015-Sep-29 - Development version
ReplyDeleteDrush Version : 7.0-dev
PHP Version : PHP 5.6.10
Still getting Error :
Drupal\Core\DependencyInjection\ContainerNotInitializedException: \Drupal::$container is not initialized yet. \Drupal::setContainer() must be called with a real container. in Drupal::getContainer() (line 129 of /Applications/MAMP/htdocs/drupal-8.0.x-dev/core/lib/Drupal.php).
Drush command terminated abnormally due to an unrecoverable error.