Skip to content

Commit decb1d4

Browse files
committed
Fix minor issues with controller tests for admin panel
1 parent c2c493f commit decb1d4

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

  • app/code/community/EcomDev/PHPUnit/Test/Case/Helper
  • lib/EcomDev/PHPUnit/Constraint/Layout

app/code/community/EcomDev/PHPUnit/Test/Case/Helper/Session.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,19 @@ class EcomDev_PHPUnit_Test_Case_Helper_Session
4343
*/
4444
public function helperMockSession($classAlias, array $methods = array())
4545
{
46+
if (!empty($methods) && !in_array('start', $methods, true)) {
47+
$methods[] = 'start';
48+
}
49+
4650
$sessionMock = EcomDev_PHPUnit_Helper::invoke('mockModel', $classAlias, $methods)
4751
->disableOriginalConstructor();
4852

4953
TestUtil::replaceByMock('singleton', $classAlias, $sessionMock);
54+
55+
$sessionMock->expects($this->testCase->any())
56+
->method('start')
57+
->willReturnSelf();
58+
5059
return $sessionMock;
5160
}
5261

@@ -58,6 +67,8 @@ public function helperMockSession($classAlias, array $methods = array())
5867
*/
5968
public function helperAdminSession(array $resources = array())
6069
{
70+
$this->helperMockSession('core/session', array('renew'));
71+
$this->helperMockSession('adminhtml/session', array('renew'));
6172
$session = $this->helperMockSession('admin/session', array('refreshAcl'));
6273
$user = $this->createUser();
6374
$this->loadRules($user, $this->getAcl(), $resources);

lib/EcomDev/PHPUnit/Constraint/Layout/Block.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ protected function evaluateRootLevel($other)
292292
return false;
293293
}
294294

295-
return $blockInfo['root'] === true;
295+
return $blockInfo['is_root'] === true;
296296
}
297297

298298
/**

0 commit comments

Comments
 (0)