Skip to content
Snippets Groups Projects
Verified Commit 0aaa9b8d authored by Dave Long's avatar Dave Long
Browse files

Issue #3167126 by ranjith_kumar_k_u, rpayanm, amateescu, mheip, CedricL,...

Issue #3167126 by ranjith_kumar_k_u, rpayanm, amateescu, mheip, CedricL, smustgrave: Call to a member function getDisplayname() on null in WorkspaceListBuilder.php
parent 1896a074
No related branches found
No related tags found
No related merge requests found
......@@ -10,6 +10,7 @@
use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\Core\Render\RendererInterface;
use Drupal\Core\Url;
use Drupal\user\UserInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
......@@ -121,7 +122,9 @@ public function buildRow(EntityInterface $entity) {
'#url' => $entity->toUrl(),
],
],
'owner' => $entity->getOwner()->getDisplayName(),
'owner' => (($owner = $entity->getOwner()) && $owner instanceof UserInterface)
? $owner->getDisplayName()
: $this->t('N/A'),
];
$row['data'] = $row['data'] + parent::buildRow($entity);
......
......@@ -299,6 +299,16 @@ public function testWorkspaceList() {
// 'Live' is no longer the active workspace, so it's 'Switch to Live'
// operation should be visible now.
$assert_session->linkExists('Switch to Live');
// Delete any of the workspace owners and visit workspaces listing.
$this->drupalLogin($this->editor2);
user_cancel([], $this->editor1->id(), 'user_cancel_reassign');
$user = \Drupal::service('entity_type.manager')->getStorage('user')->load($this->editor1->id());
$user->delete();
$this->drupalGet('/admin/config/workflow/workspaces');
$this->assertSession()->pageTextContains('Summer event');
$summer_event_workspace_row = $page->find('css', 'table tbody tr:nth-of-type(3)');
$this->assertEquals('N/A', $summer_event_workspace_row->find('css', 'td:nth-of-type(2)')->getText());
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment