Skip to content

Commit fba1b61

Browse files
authored
1 parent 6a6134c commit fba1b61

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

tests/Unit/Libraries/Cms/MVC/Controller/BaseControllerTest.php

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -337,8 +337,10 @@ public function display($tpl = null)
337337
};
338338
$mvcFactory = $this->createStub(MVCFactoryInterface::class);
339339
$mvcFactory->method('createView')->willReturn($view);
340+
$app = $this->createStub(CMSApplicationInterface::class);
341+
$app->method('getName')->willReturn('Test');
340342

341-
$controller = new class (['base_path' => __DIR__], $mvcFactory, $this->createStub(CMSApplicationInterface::class), new Input()) extends BaseController {
343+
$controller = new class (['base_path' => __DIR__], $mvcFactory, $app, new Input()) extends BaseController {
342344
};
343345

344346
$this->assertEquals($view, $controller->getView('testGetView'));
@@ -407,6 +409,7 @@ public function getUser(): User
407409

408410
$user = new User();
409411
$app = $this->createStub(CMSApplicationInterface::class);
412+
$app->method('getName')->willReturn('Test');
410413
$app->method('getIdentity')->willReturn($user);
411414

412415
$controller = new class (['base_path' => __DIR__], $mvcFactory, $app, new Input()) extends BaseController {
@@ -467,8 +470,11 @@ public function getPaths()
467470
*/
468471
public function testDisplay()
469472
{
473+
$doc = $this->createStub(Document::class);
474+
$doc->method('getType')->willReturn('html');
470475
$app = $this->createStub(CMSWebApplicationInterface::class);
471-
$app->method('getDocument')->willReturn(new Document());
476+
$app->method('getName')->willReturn('Test');
477+
$app->method('getDocument')->willReturn($doc);
472478

473479
$view = new class (['name' => 'test']) extends AbstractView {
474480
public $value = null;
@@ -498,8 +504,11 @@ public function display($tpl = null)
498504
*/
499505
public function testDisplayWithModel()
500506
{
507+
$doc = $this->createStub(Document::class);
508+
$doc->method('getType')->willReturn('html');
501509
$app = $this->createStub(CMSWebApplicationInterface::class);
502-
$app->method('getDocument')->willReturn(new Document());
510+
$app->method('getName')->willReturn('Test');
511+
$app->method('getDocument')->willReturn($doc);
503512

504513
$model = new class (['name' => 'test']) extends BaseModel {
505514
};

tests/Unit/Libraries/Cms/MVC/View/AbstractViewTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ public function display($tpl = null)
148148
};
149149
$view->set('unit', 'test');
150150

151-
$this->assertEquals('test', $view->get('unit'));
151+
$this->assertEquals('test', $view->get('unit', ''));
152152
}
153153

154154
/**

0 commit comments

Comments
 (0)