4 * Zend Framework (http://framework.zend.com/)
6 * @link http://github.com/zendframework/zf2 for the canonical source repository
7 * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
8 * @license http://framework.zend.com/license/new-bsd New BSD License
10 namespace Zend\Test\PHPUnit\Controller
;
12 use PHPUnit_Framework_ExpectationFailedException
;
14 abstract class AbstractConsoleControllerTestCase
extends AbstractControllerTestCase
17 * HTTP controller must use the console request
20 protected $useConsoleRequest = true;
23 * Assert console output contain content (insensible case)
25 * @param string $match content that should be contained in matched nodes
28 public function assertConsoleOutputContains($match)
30 $response = $this->getResponse();
31 if (false === stripos($response->getContent(), $match)) {
32 throw new PHPUnit_Framework_ExpectationFailedException(sprintf(
33 'Failed asserting output CONTAINS content "%s", actual content is "%s"',
34 $match, $response->getContent()
37 $this->assertNotSame(false, stripos($response->getContent(), $match));
41 * Assert console output not contain content
43 * @param string $match content that should be contained in matched nodes
46 public function assertNotConsoleOutputContains($match)
48 $response = $this->getResponse();
49 if (false !== stripos($response->getContent(), $match)) {
50 throw new PHPUnit_Framework_ExpectationFailedException(sprintf(
51 'Failed asserting output DOES NOT CONTAIN content "%s"',
55 $this->assertSame(false, stripos($response->getContent(), $match));