I am trying to setup a simple test that tests some breadcrumb altering code I have introduced only for a specific content type.
Here is the test, still just barebones:
namespace Drupal\mymodule_breadcrumbs\Tests;
use Drupal\simpletest\WebTestBase;
/**
* Class ArticleBreadcrumbTest
* @group mymodule_breadcrumbs
*/
class ArticleBreadcrumbTest extends WebTestBase {
protected $node;
private $account;
/**
* Modules to install.
* @var array
*/
public static $modules = ['node', 'mymodule_breadcrumbs', 'menu_breadcrumb'];
/**
* Set up our test.
*/
public function setUp() {
parent::setUp();
// create admin user
$this->account = $this->drupalCreateUser(['administer site configuration', 'administer content']);
// create article node
$this->node = $this->drupalCreateNode(array(
'title' => t('Test Article'),
'type' => 'article',
'status' => 1,
));
}
public function testNodeTitleIsInBreadcrumb() {
$this->drupalGet('node/' . $this->node->id());
$this->assertResponse(200);
#$this->assertText('Home > ' . $this->node->getTitle(), 'Breadcrumb contains the node title.');
// get page
// test that breadcrumb is correct per node title
// change node title
// save node
// visit node, check that breadcrumb is updated
}
}
However, I am getting this error and not sure what to make of it:
The website encountered an unexpected error. Please try again later.
InvalidArgumentException: Invalid database prefix: in Drupal\Core\Test\TestDatabase->__construct() (line 81 of core/lib/Drupal/Core/Test/TestDatabase.php).
simpletest_log_read(NULL, , ) (Line: 476)
_simpletest_batch_finished(, Array, Array, '1 sec')
call_user_func_array('_simpletest_batch_finished', Array) (Line: 414)
_batch_finished() (Line: 81)
_batch_page(Object) (Line: 55)
Drupal\system\Controller\BatchController->batchPage(Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 574)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
call_user_func_array(Object, Array) (Line: 144)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 64)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 99)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 78)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 50)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 652)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
It's a very basic test, why would it cause an error like that?
Also I am running this from the UI runner, if that makes a difference.