Verified Commit 099a9c21 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

(cherry picked from commit 0aaa9b8d)
parent baed1cce
Loading
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -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);

+10 −0
Original line number Diff line number Diff line
@@ -297,6 +297,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());
  }

  /**