Skip to content
This repository was archived by the owner on Jan 31, 2020. It is now read-only.

Commit 593868e

Browse files
author
porebskk
committed
zend-view-152 Added fluent interface to ConsoleModel::setErrorLevel
1 parent 827a43c commit 593868e

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

src/Model/ConsoleModel.php

+2
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,12 @@ class ConsoleModel extends ViewModel
3131
* Set error level to return after the application ends.
3232
*
3333
* @param int $errorLevel
34+
* @return $this
3435
*/
3536
public function setErrorLevel($errorLevel)
3637
{
3738
$this->options['errorLevel'] = $errorLevel;
39+
return $this;
3840
}
3941

4042
/**

test/Model/ConsoleModelTest.php

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php
2+
3+
namespace ZendTest\View\Model;
4+
5+
use PHPUnit\Framework\TestCase;
6+
use Zend\View\Model\ConsoleModel;
7+
8+
class ConsoleModelTest extends TestCase
9+
{
10+
public function testImplementsModelInterface()
11+
{
12+
$model = new ConsoleModel();
13+
$this->assertInstanceOf('Zend\View\Model\ModelInterface', $model);
14+
}
15+
16+
/**
17+
* @group zend-view-152
18+
* @see https://github.com/zendframework/zend-view/issues/152
19+
*/
20+
public function testSetErrorLevelIsReturningThis()
21+
{
22+
$model = new ConsoleModel();
23+
$actual = $model->setErrorLevel(0);
24+
$this->assertSame($model, $actual);
25+
}
26+
}

0 commit comments

Comments
 (0)