-
Notifications
You must be signed in to change notification settings - Fork 91
Fix 'Call to a member function hasChildren() on boolean' #26
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -90,4 +90,35 @@ public function testIgnoresNonConsoleModelNotContainingResultKeyWhenObtainingRes | |
$content = $response->getContent(); | ||
$this->assertNotContains('Page not found', $content); | ||
} | ||
|
||
public function testIgnoresNonModel() | ||
{ | ||
$console = $this->getMock('Zend\Console\Adapter\AbstractAdapter'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
$console | ||
->expects($this->any()) | ||
->method('encodeText') | ||
->willReturnArgument(0) | ||
; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Semicolon on the previous line |
||
|
||
//Register console service | ||
$sm = new ServiceManager(); | ||
$sm->setService('console', $console); | ||
|
||
/** @var \PHPUnit_Framework_MockObject_MockObject|\Zend\Mvc\ApplicationInterface $mockApplication */ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. IDE hints should use |
||
$mockApplication = $this->getMock('Zend\Mvc\ApplicationInterface'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
$mockApplication | ||
->expects($this->any()) | ||
->method('getServiceManager') | ||
->willReturn($sm) | ||
; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Semicolon on the previous line There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We don't have CS guidelines about the placement of the trailing semicolon on a method chain There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, nothing came up when I ran cs fixer either. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No strong feelings on it, I guess we'll eventually add the rule later on, if this keeps popping up |
||
|
||
$event = new MvcEvent(); | ||
$event->setApplication($mockApplication); | ||
|
||
$model = true; | ||
$response = new Response(); | ||
$event->setResult($model); | ||
$event->setResponse($response); | ||
$this->assertSame($response, $this->strategy->render($event)); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can simply remove the
empty()
callThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Except this comment, all of your other comments relate to the existing test code that I copied. So I'll apply your suggestions to both tests - I was just following what was already there :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@skl thanks!