Commit 3813760c authored by catch's avatar catch
Browse files

Issue #3154084 by amateescu, mheip, smustgrave: Warning when building an empty workspace tree

(cherry picked from commit 2a17c29f)
parent 8fcfee20
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -116,6 +116,7 @@ public function loadTree() {
      }
      $graph = (new Graph($graph))->searchAndSort();

      $this->tree = [];
      foreach (array_keys($tree) as $workspace_id) {
        $this->tree[$workspace_id] = [
          'depth' => count($graph[$workspace_id]['paths']),
+8 −0
Original line number Diff line number Diff line
@@ -323,4 +323,12 @@ public function testDeletingWorkspaceWithChildren() {
    $this->assertNull(Workspace::load('stage'));
  }

  /**
   * Tests loading the workspace tree when there are no workspaces available.
   */
  public function testEmptyWorkspaceTree() {
    $tree = \Drupal::service('workspaces.repository')->loadTree();
    $this->assertSame([], $tree);
  }

}