Skip to content

Commit 4d532a6

Browse files
authored
Merge pull request #955 from APY/test-improvement-grid-manager
Added GridManagerTest
2 parents f8a13ef + 41c7bb7 commit 4d532a6

2 files changed

Lines changed: 608 additions & 4 deletions

File tree

Grid/GridManager.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ class GridManager implements \IteratorAggregate, \Countable
2727

2828
protected $massActionGrid = null;
2929

30+
const NO_GRID_EX_MSG = 'No grid has been added to the manager.';
31+
32+
const SAME_GRID_HASH_EX_MSG = 'Some grids seem similar. Please set an Indentifier for your grids.';
33+
3034
public function __construct($container)
3135
{
3236
$this->container = $container;
@@ -64,7 +68,7 @@ public function createGrid($id = null)
6468
public function isReadyForRedirect()
6569
{
6670
if ($this->grids->count() == 0) {
67-
throw new \RuntimeException('No grid has been added to the manager.');
71+
throw new \RuntimeException(self::NO_GRID_EX_MSG);
6872
}
6973

7074
$checkHash = [];
@@ -86,7 +90,7 @@ public function isReadyForRedirect()
8690
}
8791

8892
if (in_array($grid->getHash(), $checkHash)) {
89-
throw new \RuntimeException('Some grids seem similar. Please set an Indentifier for your grids.');
93+
throw new \RuntimeException(self::SAME_GRID_HASH_EX_MSG);
9094
}
9195

9296
$checkHash[] = $grid->getHash();
@@ -100,7 +104,7 @@ public function isReadyForRedirect()
100104
public function isReadyForExport()
101105
{
102106
if ($this->grids->count() == 0) {
103-
throw new \RuntimeException('No grid has been added to the manager.');
107+
throw new \RuntimeException(self::NO_GRID_EX_MSG);
104108
}
105109

106110
$checkHash = [];
@@ -110,7 +114,7 @@ public function isReadyForExport()
110114
$grid = $this->grids->current();
111115

112116
if (in_array($grid->getHash(), $checkHash)) {
113-
throw new \RuntimeException('Some grids seem similar. Please set an Indentifier for your grids.');
117+
throw new \RuntimeException(self::SAME_GRID_HASH_EX_MSG);
114118
}
115119

116120
$checkHash[] = $grid->getHash();

0 commit comments

Comments
 (0)