mirror of
https://github.com/torrentpier/torrentpier-lts.git
synced 2025-02-28 15:10:54 +03:00
61 lines
1.9 KiB
PHP
61 lines
1.9 KiB
PHP
<?php
|
|
|
|
/**
|
|
* Zend Framework (http://framework.zend.com/)
|
|
*
|
|
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
|
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
|
|
* @license http://framework.zend.com/license/new-bsd New BSD License
|
|
*/
|
|
namespace Zend\Test\PHPUnit\Controller;
|
|
|
|
use PHPUnit_Framework_ExpectationFailedException;
|
|
|
|
abstract class AbstractConsoleControllerTestCase extends AbstractControllerTestCase
|
|
{
|
|
/**
|
|
* HTTP controller must use the console request
|
|
* @var bool
|
|
*/
|
|
protected $useConsoleRequest = true;
|
|
|
|
/**
|
|
* Assert console output contain content (insensible case)
|
|
*
|
|
* @param string $match content that should be contained in matched nodes
|
|
* @return void
|
|
*/
|
|
public function assertConsoleOutputContains($match)
|
|
{
|
|
$response = $this->getResponse();
|
|
if (false === stripos($response->getContent(), $match)) {
|
|
throw new PHPUnit_Framework_ExpectationFailedException(
|
|
sprintf(
|
|
'Failed asserting output CONTAINS content "%s", actual content is "%s"',
|
|
$match,
|
|
$response->getContent()
|
|
)
|
|
);
|
|
}
|
|
$this->assertNotSame(false, stripos($response->getContent(), $match));
|
|
}
|
|
|
|
/**
|
|
* Assert console output not contain content
|
|
*
|
|
* @param string $match content that should be contained in matched nodes
|
|
* @return void
|
|
*/
|
|
public function assertNotConsoleOutputContains($match)
|
|
{
|
|
$response = $this->getResponse();
|
|
if (false !== stripos($response->getContent(), $match)) {
|
|
throw new PHPUnit_Framework_ExpectationFailedException(sprintf(
|
|
'Failed asserting output DOES NOT CONTAIN content "%s"',
|
|
$match
|
|
));
|
|
}
|
|
$this->assertSame(false, stripos($response->getContent(), $match));
|
|
}
|
|
}
|