Add more tests

This commit is contained in:
Dennis Eichhorn 2018-02-22 13:54:08 +01:00
parent c43d83d8c0
commit cc904e772a
43 changed files with 600 additions and 95 deletions

View File

@ -1061,7 +1061,7 @@ class FinanceFormulas
*
* @return float
*
* @throws InvalidDimensionException Throws this exception if the length of the array is 0
* @throws \UnexpectedValueException Throws this exception if the length of the array is 0
*
* @since 1.0.0
*/
@ -1070,7 +1070,7 @@ class FinanceFormulas
$count = count($C);
if ($count === 0) {
throw new InvalidDimensionException($count);
throw new \UnexpectedValueException((string) $count);
}
$npv = -$C[0];

View File

@ -552,7 +552,9 @@ class FileLogger implements LoggerInterface
*/
public function console(string $message, bool $verbose = true, array $context = []) /* : void */
{
$message = date('[Y-m-d H:i:s] ') . $message . "\r\n";
if (empty($context)) {
$message = date('[Y-m-d H:i:s] ') . $message . "\r\n";
}
if ($verbose) {
echo $message;

View File

@ -106,7 +106,7 @@ class Response extends ResponseAbstract implements RenderableInterface
foreach ($types as $type) {
if (stripos($type, MimeType::M_JSON) !== false) {
return $this->jsonSerialize();
return json_encode($this->jsonSerialize());
}
}

View File

@ -27,7 +27,7 @@ abstract class ResponseAbstract implements MessageInterface, \JsonSerializable
/**
* Responses.
*
* @var string[]
* @var array
* @since 1.0.0
*/
protected $response = [];
@ -49,9 +49,9 @@ abstract class ResponseAbstract implements MessageInterface, \JsonSerializable
*
* @since 1.0.0
*/
public function &get($id)
public function get($id)
{
return $this->response[$id];
return $this->response[$id] ?? null;
}
/**
@ -77,7 +77,7 @@ abstract class ResponseAbstract implements MessageInterface, \JsonSerializable
*/
public function jsonSerialize()
{
return json_encode($this->toArray());
return $this->toArray();
}
/**

View File

@ -189,8 +189,9 @@ class Head implements RenderableInterface
{
$head = '';
$head .= $this->meta->render();
$head .= $this->renderStyle();
$head .= $this->renderScript();
$head .= $this->renderAssets();
$head .= empty($this->style) ? '' : '<style>' . $this->renderStyle() . '</style>';
$head .= empty($this->script) ? '' : '<script>' . $this->renderScript() . '</script>';
return $head;
}

View File

@ -15,6 +15,7 @@ declare(strict_types=1);
namespace phpOMS\Model\Html;
use phpOMS\Contract\RenderableInterface;
use phpOMS\Views\ViewAbstract;
/**
* Meta class.
@ -170,10 +171,10 @@ class Meta implements RenderableInterface
*/
public function render() : string
{
return (count($this->keywords) > 0 ? '<meta name="keywords" content="' . implode(',', $this->keywords) . '">"' : '')
. (!empty($this->author) ? '<meta name="author" content="' . $this->author . '">' : '')
. (!empty($this->description) ? '<meta name="description" content="' . $this->description . '">' : '')
. (!empty($this->charset) ? '<meta charset="' . $this->charset . '">' : '')
return (count($this->keywords) > 0 ? '<meta name="keywords" content="' . ViewAbstract::html(implode(',', $this->keywords)) . '">"' : '')
. (!empty($this->author) ? '<meta name="author" content="' . ViewAbstract::html($this->author) . '">' : '')
. (!empty($this->description) ? '<meta name="description" content="' . ViewAbstract::html($this->description) . '">' : '')
. (!empty($this->charset) ? '<meta charset="' . ViewAbstract::html($this->charset) . '">' : '')
. '<meta name="generator" content="Orange Management">';
}
}

View File

@ -48,7 +48,7 @@ class PhpCode
*
* @since 1.0.0
*/
private static function normalizeSource(string $source) : string
public static function normalizeSource(string $source) : string
{
return str_replace(["\n", "\r\n", "\r", "\t"], ['', '', '', ' '], $source);
}
@ -102,8 +102,6 @@ class PhpCode
*/
public static function hasDeprecatedFunction(string $source) : bool
{
$source = self::normalizeSource($source);
foreach (self::$deprecatedFunctions as $function) {
if (preg_match('/' . $function . '\s*\(/', $source) === 1) {
return true;

View File

@ -297,6 +297,25 @@ class ArrayUtils
return trim($args[$key + 1], '" ');
}
/**
* Check if flag is set
*
* @param string $id Id to find
* @param array $args CLI command list
*
* @return int
*
* @since 1.0.0
*/
public static function hasArg(string $id, array $args) /* : ?int */
{
if (($key = array_search($id, $args)) === false) {
return null;
}
return $key;
}
/**
* Flatten array
*

View File

@ -106,6 +106,18 @@ class Repository
}
}
/**
* Get repository path.
*
* @return string
*
* @since 1.0.0
*/
public function getPath() : string
{
return $this->path;
}
/**
* Get active Branch.
*

View File

@ -27,15 +27,6 @@ use phpOMS\Validation\ValidatorAbstract;
abstract class DateTime extends ValidatorAbstract
{
/**
* Constructor.
*
* @since 1.0.0
*/
public function __construct()
{
}
/**
* {@inheritdoc}
*/

View File

@ -24,18 +24,9 @@ use phpOMS\Validation\ValidatorAbstract;
* @link http://website.orange-management.de
* @since 1.0.0
*/
abstract class BIC extends ValidatorAbstract
final class BIC extends ValidatorAbstract
{
/**
* Constructor.
*
* @since 1.0.0
*/
public function __construct()
{
}
/**
* {@inheritdoc}
*/

View File

@ -24,18 +24,9 @@ use phpOMS\Validation\ValidatorAbstract;
* @link http://website.orange-management.de
* @since 1.0.0
*/
abstract class CreditCard extends ValidatorAbstract
final class CreditCard extends ValidatorAbstract
{
/**
* Constructor.
*
* @since 1.0.0
*/
public function __construct()
{
}
/**
* {@inheritdoc}
*/

View File

@ -24,18 +24,8 @@ use phpOMS\Validation\ValidatorAbstract;
* @link http://website.orange-management.de
* @since 1.0.0
*/
abstract class Iban extends ValidatorAbstract
final class Iban extends ValidatorAbstract
{
/**
* Constructor.
*
* @since 1.0.0
* @codeCoverageIgnore
*/
private function __construct()
{
}
/**
* {@inheritdoc}
*/

View File

@ -43,10 +43,16 @@ final class Validator extends ValidatorAbstract
return true;
}
foreach ($constraints as $callback => $settings) {
$callback = StringUtils::endsWith($callback, 'Not') ? substr($callback, 0, -3) : $callback;
$valid = self::$callback($var, ...$settings);
$valid = (StringUtils::endsWith($callback, 'Not') ? $valid : !$valid);
foreach ($constraints as $test => $settings) {
$callback = StringUtils::endsWith($test, 'Not') ? substr($test, 0, -3) : $test;
if (!empty($settings)) {
$valid = $callback($var, ...$settings);
} else {
$valid = $callback($var);
}
$valid = (StringUtils::endsWith($test, 'Not') ? !$valid : $valid);
if (!$valid) {
return false;
@ -130,7 +136,7 @@ final class Validator extends ValidatorAbstract
*/
public static function matches(string $var, string $pattern) : bool
{
return (preg_match($pattern, $var) !== false ? true : false);
return (preg_match($pattern, $var) === 1 ? true : false);
}
/**

View File

@ -217,20 +217,6 @@ class View extends ViewAbstract
return htmlspecialchars($this->getText($translation, $module, $theme));
}
/**
* Print html output.
*
* @param mixed $text Text
*
* @return string
*
* @since 1.0.0
*/
public function printHtml($text) : string
{
return htmlspecialchars((string) $text);
}
/**
* Get request of view
*

View File

@ -97,6 +97,34 @@ abstract class ViewAbstract implements \Serializable
$this->template = $template;
}
/**
* Print html output.
*
* @param mixed $text Text
*
* @return string
*
* @since 1.0.0
*/
public function printHtml($text) : string
{
return htmlspecialchars((string) $text);
}
/**
* Print html output.
*
* @param mixed $text Text
*
* @return string
*
* @since 1.0.0
*/
public static function html($text) : string
{
return htmlspecialchars((string) $text);
}
/**
* Returns all views
*

View File

@ -183,6 +183,9 @@ class FinanceFormulasTest extends \PHPUnit\Framework\TestCase
self::assertEquals(500 / 1000 - 1, FinanceFormulas::getReturnOnInvestment(500, 1000));
self::assertEquals((500 - 300) / 500, FinanceFormulas::getRetentionRatio(500, 300));
self::assertEquals(500 / 1000 - 1, FinanceFormulas::getRateOfOnflation(500, 1000));
self::assertEquals(1000 / 500, FinanceFormulas::getPaybackPeriod(1000, 500));
self::assertEquals(100 / 0.15, FinanceFormulas::getPresentValueOfPerpetuity(100, 0.15));
}
public function testCompound()
@ -305,12 +308,13 @@ class FinanceFormulasTest extends \PHPUnit\Framework\TestCase
self::assertEquals(2857.65, FinanceFormulas::getFutureValueContinuousCompounding($pv, $r, $t), '', 0.01);
}
public function testFutureValueFactor()
public function testValueFactor()
{
$r = 0.15;
$n = 7;
self::assertEquals(2.66, FinanceFormulas::getFutureValueFactor($r, $n), '', 0.01);
self::assertEquals(0.37594, FinanceFormulas::getPresentValueFactor($r, $n), '', 0.01);
}
public function testGeometricMeanReturn()
@ -377,6 +381,14 @@ class FinanceFormulasTest extends \PHPUnit\Framework\TestCase
self::assertEquals(172.13, FinanceFormulas::getNetPresentValue($c, $r), '', 0.01);
}
/**
* @expectedException \UnexpectedValueException
*/
public function testInvalidNetPresentValue()
{
FinanceFormulas::getNetPresentValue([], 0.1);
}
public function testRealRateOfReturn()
{
$nominal = 0.15;
@ -384,4 +396,36 @@ class FinanceFormulasTest extends \PHPUnit\Framework\TestCase
self::assertEquals(0.09524, FinanceFormulas::getRealRateOfReturn($nominal, $inflation), '', 0.01);
}
public function testNetWorkingCapital()
{
self::assertEquals(1000 - 600, FinanceFormulas::getNetWorkingCapital(1000, 600), '', 0.01);
}
public function testNumberOfPeriodsPVFV()
{
$fv = 1200;
$pv = 1000;
$r = 0.03;
self::assertEquals(6.1681, FinanceFormulas::getNumberOfPeriodsPVFV($fv, $pv, $r), '', 0.01);
}
public function testPresentValue()
{
$c = 1000;
$r = 0.15;
$n = 7;
self::assertEquals(375.94, FinanceFormulas::getPresentValue($c, $r, $n), '', 0.01);
}
public function testPresentValueContinuousCompounding()
{
$c = 1000;
$r = 0.15;
$t = 7;
self::assertEquals(349.94, FinanceFormulas::getPresentValueContinuousCompounding($c, $r, $t), '', 0.01);
}
}

View File

@ -66,4 +66,50 @@ class StockBondsTest extends \PHPUnit\Framework\TestCase
self::assertEquals(1.75, StockBonds::getNetAssetValue($assets, $liabilities, $shares), '', 0.01);
}
public function testPresentValueOfStockConstantGrowth()
{
$div = 500;
$r = 0.15;
$g = 0.05;
self::assertEquals(5000, StockBonds::getPresentValueOfStockConstantGrowth($div, $r, $g), '', 0.01);
}
public function testTotalStockReturn()
{
$p0 = 1000;
$p1 = 1200;
$d = 100;
self::assertEquals(0.3, StockBonds::getTotalStockReturn($p0, $p1, $d), '', 0.01);
}
public function testYieldToMaturity()
{
$c = 100;
$f = 1000;
$p = 920;
$n = 10;
self::assertEquals(0.1138, StockBonds::getYieldToMaturity($c, $f, $p, $n), '', 0.01);
}
public function testZeroCouponBondValue()
{
$f = 100;
$r = 0.06;
$t = 5;
self::assertEquals(74.73, StockBonds::getZeroCouponBondValue($f, $r, $t), '', 0.01);
}
public function testZeroCouponBondEffectiveYield()
{
$f = 100;
$pv = 90;
$n = 5;
self::assertEquals(0.01517, StockBonds::getZeroCouponBondEffectiveYield($f, $pv, $n), '', 0.01);
}
}

View File

@ -125,4 +125,12 @@ class DispatcherTest extends \PHPUnit\Framework\TestCase
{
$this->app->dispatcher->dispatch('phpOMS\tests\Dispatcher\TestControllers::testFunctionStatic');
}
/**
* @expectedException \UnexpectedValueException
*/
public function testInvalidControllerString()
{
$this->app->dispatcher->dispatch('phpOMS\tests\Dispatcher\TestController::testFunctionStatic:failure');
}
}

View File

@ -56,6 +56,12 @@ class LocalizationTest extends \PHPUnit\Framework\TestCase
self::assertEquals('.', $localization->getDecimal());
self::assertEquals(',', $localization->getThousands());
self::assertEquals('Y-m-d H:i:s', $localization->getDatetime());
self::assertEquals([], $localization->getSpeed());
self::assertEquals([], $localization->getWeight());
self::assertEquals([], $localization->getLength());
self::assertEquals([], $localization->getArea());
self::assertEquals([], $localization->getVolume());
}
/**

View File

@ -1,2 +0,0 @@
2017-12-23 06:28:59; error ; 0.0.0.0 ; 30 ; 7.0.5 ; WINNT ; REQUEST_URI; Unhandled error; C:\Users\coyle\Desktop\Orange-ManagementphpOMS\tests\UnhandledHandlerTest.php; [{"file":"C:\\Users\\coyle\\Desktop\\Orange-Management\\phpOMS\\Log\\FileLogger.php","line":353,"function":"interpolate","class":"phpOMS\\Log\\FileLogger","object":{},"type":"->"},{"file":"C:\\Users\\coyle\\Desktop\\Orange-Management\\phpOMS\\UnhandledHandler.php","line":82,"function":"error","class":"phpOMS\\Log\\FileLogger","object":{},"type":"->"},{"function":"errorHandler","class":"phpOMS\\UnhandledHandler","type":"::"},{"file":"C:\\Users\\coyle\\Desktop\\Orange-Management\\Tests\\PHPUnit\\phpOMS\\UnhandledHandlerTest.php","line":30,"function":"trigger_error"},{"function":"testErrorHandling","class":"Tests\\PHPUnit\\phpOMS\\UnhandledHandlerTest","object":{},"type":"->"},{"file":"phar:\/\/C:\/Users\/coyle\/Desktop\/Orange-Management\/phpunit.phar\/phpunit\/Framework\/TestCase.php","line":1071,"function":"invokeArgs","class":"ReflectionMethod","object":{"name":"testErrorHandling","class":"Tests\\PHPUnit\\phpOMS\\UnhandledHandlerTest"},"type":"->"},{"file":"phar:\/\/C:\/Users\/coyle\/Desktop\/Orange-Management\/phpunit.phar\/phpunit\/Framework\/TestCase.php","line":939,"function":"runTest","class":"PHPUnit\\Framework\\TestCase","object":{},"type":"->"},{"file":"phar:\/\/C:\/Users\/coyle\/Desktop\/Orange-Management\/phpunit.phar\/phpunit\/Framework\/TestResult.php","line":698,"function":"runBare","class":"PHPUnit\\Framework\\TestCase","object":{},"type":"->"},{"file":"phar:\/\/C:\/Users\/coyle\/Desktop\/Orange-Management\/phpunit.phar\/phpunit\/Framework\/TestCase.php","line":894,"function":"run","class":"PHPUnit\\Framework\\TestResult","object":{},"type":"->"},{"file":"phar:\/\/C:\/Users\/coyle\/Desktop\/Orange-Management\/phpunit.phar\/phpunit\/Framework\/TestSuite.php","line":744,"function":"run","class":"PHPUnit\\Framework\\TestCase","object":{},"type":"->"},{"file":"phar:\/\/C:\/Users\/coyle\/Desktop\/Orange-Management\/phpunit.phar\/phpunit\/Framework\/TestSuite.php","line":744,"function":"run","class":"PHPUnit\\Framework\\TestSuite","object":{},"type":"->"},{"file":"phar:\/\/C:\/Users\/coyle\/Desktop\/Orange-Management\/phpunit.phar\/phpunit\/Framework\/TestSuite.php","line":744,"function":"run","class":"PHPUnit\\Framework\\TestSuite","object":{},"type":"->"},{"file":"phar:\/\/C:\/Users\/coyle\/Desktop\/Orange-Management\/phpunit.phar\/phpunit\/TextUI\/TestRunner.php","line":537,"function":"run","class":"PHPUnit\\Framework\\TestSuite","object":{},"type":"->"},{"file":"phar:\/\/C:\/Users\/coyle\/Desktop\/Orange-Management\/phpunit.phar\/phpunit\/TextUI\/Command.php","line":195,"function":"doRun","class":"PHPUnit\\TextUI\\TestRunner","object":{},"type":"->"},{"file":"phar:\/\/C:\/Users\/coyle\/Desktop\/Orange-Management\/phpunit.phar\/phpunit\/TextUI\/Command.php","line":148,"function":"run","class":"PHPUnit\\TextUI\\Command","object":{},"type":"->"},{"file":"C:\\Users\\coyle\\Desktop\\Orange-Management\\phpunit.phar","line":566,"function":"main","class":"PHPUnit\\TextUI\\Command","type":"::"}]
2017-12-23 06:28:59; error ; 0.0.0.0 ; 0 ; 7.0.5 ; WINNT ; REQUEST_URI; Undefined error; ; [{"file":"C:\\Users\\coyle\\Desktop\\Orange-Management\\phpOMS\\Log\\FileLogger.php","line":353,"function":"interpolate","class":"phpOMS\\Log\\FileLogger","object":{},"type":"->"},{"file":"C:\\Users\\coyle\\Desktop\\Orange-Management\\phpOMS\\UnhandledHandler.php","line":70,"function":"error","class":"phpOMS\\Log\\FileLogger","object":{},"type":"->"},{"file":"C:\\Users\\coyle\\Desktop\\Orange-Management\\Tests\\PHPUnit\\phpOMS\\UnhandledHandlerTest.php","line":34,"function":"errorHandler","class":"phpOMS\\UnhandledHandler","type":"::"},{"function":"testErrorHandling","class":"Tests\\PHPUnit\\phpOMS\\UnhandledHandlerTest","object":{},"type":"->"},{"file":"phar:\/\/C:\/Users\/coyle\/Desktop\/Orange-Management\/phpunit.phar\/phpunit\/Framework\/TestCase.php","line":1071,"function":"invokeArgs","class":"ReflectionMethod","object":{"name":"testErrorHandling","class":"Tests\\PHPUnit\\phpOMS\\UnhandledHandlerTest"},"type":"->"},{"file":"phar:\/\/C:\/Users\/coyle\/Desktop\/Orange-Management\/phpunit.phar\/phpunit\/Framework\/TestCase.php","line":939,"function":"runTest","class":"PHPUnit\\Framework\\TestCase","object":{},"type":"->"},{"file":"phar:\/\/C:\/Users\/coyle\/Desktop\/Orange-Management\/phpunit.phar\/phpunit\/Framework\/TestResult.php","line":698,"function":"runBare","class":"PHPUnit\\Framework\\TestCase","object":{},"type":"->"},{"file":"phar:\/\/C:\/Users\/coyle\/Desktop\/Orange-Management\/phpunit.phar\/phpunit\/Framework\/TestCase.php","line":894,"function":"run","class":"PHPUnit\\Framework\\TestResult","object":{},"type":"->"},{"file":"phar:\/\/C:\/Users\/coyle\/Desktop\/Orange-Management\/phpunit.phar\/phpunit\/Framework\/TestSuite.php","line":744,"function":"run","class":"PHPUnit\\Framework\\TestCase","object":{},"type":"->"},{"file":"phar:\/\/C:\/Users\/coyle\/Desktop\/Orange-Management\/phpunit.phar\/phpunit\/Framework\/TestSuite.php","line":744,"function":"run","class":"PHPUnit\\Framework\\TestSuite","object":{},"type":"->"},{"file":"phar:\/\/C:\/Users\/coyle\/Desktop\/Orange-Management\/phpunit.phar\/phpunit\/Framework\/TestSuite.php","line":744,"function":"run","class":"PHPUnit\\Framework\\TestSuite","object":{},"type":"->"},{"file":"phar:\/\/C:\/Users\/coyle\/Desktop\/Orange-Management\/phpunit.phar\/phpunit\/TextUI\/TestRunner.php","line":537,"function":"run","class":"PHPUnit\\Framework\\TestSuite","object":{},"type":"->"},{"file":"phar:\/\/C:\/Users\/coyle\/Desktop\/Orange-Management\/phpunit.phar\/phpunit\/TextUI\/Command.php","line":195,"function":"doRun","class":"PHPUnit\\TextUI\\TestRunner","object":{},"type":"->"},{"file":"phar:\/\/C:\/Users\/coyle\/Desktop\/Orange-Management\/phpunit.phar\/phpunit\/TextUI\/Command.php","line":148,"function":"run","class":"PHPUnit\\TextUI\\Command","object":{},"type":"->"},{"file":"C:\\Users\\coyle\\Desktop\\Orange-Management\\phpunit.phar","line":566,"function":"main","class":"PHPUnit\\TextUI\\Command","type":"::"}]

View File

@ -1,2 +0,0 @@
2018-01-05 09:17:52; error ; 0.0.0.0 ; 29 ; 7.0.5 ; WINNT ; REQUEST_URI; Unhandled error; C:\Users\coyle\Desktop\Orange-ManagementphpOMS\tests\UnhandledHandlerTest.php; [{"file":"C:\\Users\\coyle\\Desktop\\Orange-Management\\phpOMS\\Log\\FileLogger.php","line":351,"function":"interpolate","class":"phpOMS\\Log\\FileLogger","object":{},"type":"->"},{"file":"C:\\Users\\coyle\\Desktop\\Orange-Management\\phpOMS\\UnhandledHandler.php","line":80,"function":"error","class":"phpOMS\\Log\\FileLogger","object":{},"type":"->"},{"function":"errorHandler","class":"phpOMS\\UnhandledHandler","type":"::"},{"file":"C:\\Users\\coyle\\Desktop\\Orange-Management\\Tests\\PHPUnit\\phpOMS\\UnhandledHandlerTest.php","line":29,"function":"trigger_error"},{"function":"testErrorHandling","class":"Tests\\PHPUnit\\phpOMS\\UnhandledHandlerTest","object":{},"type":"->"},{"file":"phar:\/\/C:\/Users\/coyle\/Desktop\/Orange-Management\/phpunit.phar\/phpunit\/Framework\/TestCase.php","line":1071,"function":"invokeArgs","class":"ReflectionMethod","object":{"name":"testErrorHandling","class":"Tests\\PHPUnit\\phpOMS\\UnhandledHandlerTest"},"type":"->"},{"file":"phar:\/\/C:\/Users\/coyle\/Desktop\/Orange-Management\/phpunit.phar\/phpunit\/Framework\/TestCase.php","line":939,"function":"runTest","class":"PHPUnit\\Framework\\TestCase","object":{},"type":"->"},{"file":"phar:\/\/C:\/Users\/coyle\/Desktop\/Orange-Management\/phpunit.phar\/phpunit\/Framework\/TestResult.php","line":698,"function":"runBare","class":"PHPUnit\\Framework\\TestCase","object":{},"type":"->"},{"file":"phar:\/\/C:\/Users\/coyle\/Desktop\/Orange-Management\/phpunit.phar\/phpunit\/Framework\/TestCase.php","line":894,"function":"run","class":"PHPUnit\\Framework\\TestResult","object":{},"type":"->"},{"file":"phar:\/\/C:\/Users\/coyle\/Desktop\/Orange-Management\/phpunit.phar\/phpunit\/Framework\/TestSuite.php","line":744,"function":"run","class":"PHPUnit\\Framework\\TestCase","object":{},"type":"->"},{"file":"phar:\/\/C:\/Users\/coyle\/Desktop\/Orange-Management\/phpunit.phar\/phpunit\/Framework\/TestSuite.php","line":744,"function":"run","class":"PHPUnit\\Framework\\TestSuite","object":{},"type":"->"},{"file":"phar:\/\/C:\/Users\/coyle\/Desktop\/Orange-Management\/phpunit.phar\/phpunit\/Framework\/TestSuite.php","line":744,"function":"run","class":"PHPUnit\\Framework\\TestSuite","object":{},"type":"->"},{"file":"phar:\/\/C:\/Users\/coyle\/Desktop\/Orange-Management\/phpunit.phar\/phpunit\/TextUI\/TestRunner.php","line":537,"function":"run","class":"PHPUnit\\Framework\\TestSuite","object":{},"type":"->"},{"file":"phar:\/\/C:\/Users\/coyle\/Desktop\/Orange-Management\/phpunit.phar\/phpunit\/TextUI\/Command.php","line":195,"function":"doRun","class":"PHPUnit\\TextUI\\TestRunner","object":{},"type":"->"},{"file":"phar:\/\/C:\/Users\/coyle\/Desktop\/Orange-Management\/phpunit.phar\/phpunit\/TextUI\/Command.php","line":148,"function":"run","class":"PHPUnit\\TextUI\\Command","object":{},"type":"->"},{"file":"C:\\Users\\coyle\\Desktop\\Orange-Management\\phpunit.phar","line":566,"function":"main","class":"PHPUnit\\TextUI\\Command","type":"::"}]
2018-01-05 09:17:52; error ; 0.0.0.0 ; 0 ; 7.0.5 ; WINNT ; REQUEST_URI; Undefined error; ; [{"file":"C:\\Users\\coyle\\Desktop\\Orange-Management\\phpOMS\\Log\\FileLogger.php","line":351,"function":"interpolate","class":"phpOMS\\Log\\FileLogger","object":{},"type":"->"},{"file":"C:\\Users\\coyle\\Desktop\\Orange-Management\\phpOMS\\UnhandledHandler.php","line":68,"function":"error","class":"phpOMS\\Log\\FileLogger","object":{},"type":"->"},{"file":"C:\\Users\\coyle\\Desktop\\Orange-Management\\Tests\\PHPUnit\\phpOMS\\UnhandledHandlerTest.php","line":33,"function":"errorHandler","class":"phpOMS\\UnhandledHandler","type":"::"},{"function":"testErrorHandling","class":"Tests\\PHPUnit\\phpOMS\\UnhandledHandlerTest","object":{},"type":"->"},{"file":"phar:\/\/C:\/Users\/coyle\/Desktop\/Orange-Management\/phpunit.phar\/phpunit\/Framework\/TestCase.php","line":1071,"function":"invokeArgs","class":"ReflectionMethod","object":{"name":"testErrorHandling","class":"Tests\\PHPUnit\\phpOMS\\UnhandledHandlerTest"},"type":"->"},{"file":"phar:\/\/C:\/Users\/coyle\/Desktop\/Orange-Management\/phpunit.phar\/phpunit\/Framework\/TestCase.php","line":939,"function":"runTest","class":"PHPUnit\\Framework\\TestCase","object":{},"type":"->"},{"file":"phar:\/\/C:\/Users\/coyle\/Desktop\/Orange-Management\/phpunit.phar\/phpunit\/Framework\/TestResult.php","line":698,"function":"runBare","class":"PHPUnit\\Framework\\TestCase","object":{},"type":"->"},{"file":"phar:\/\/C:\/Users\/coyle\/Desktop\/Orange-Management\/phpunit.phar\/phpunit\/Framework\/TestCase.php","line":894,"function":"run","class":"PHPUnit\\Framework\\TestResult","object":{},"type":"->"},{"file":"phar:\/\/C:\/Users\/coyle\/Desktop\/Orange-Management\/phpunit.phar\/phpunit\/Framework\/TestSuite.php","line":744,"function":"run","class":"PHPUnit\\Framework\\TestCase","object":{},"type":"->"},{"file":"phar:\/\/C:\/Users\/coyle\/Desktop\/Orange-Management\/phpunit.phar\/phpunit\/Framework\/TestSuite.php","line":744,"function":"run","class":"PHPUnit\\Framework\\TestSuite","object":{},"type":"->"},{"file":"phar:\/\/C:\/Users\/coyle\/Desktop\/Orange-Management\/phpunit.phar\/phpunit\/Framework\/TestSuite.php","line":744,"function":"run","class":"PHPUnit\\Framework\\TestSuite","object":{},"type":"->"},{"file":"phar:\/\/C:\/Users\/coyle\/Desktop\/Orange-Management\/phpunit.phar\/phpunit\/TextUI\/TestRunner.php","line":537,"function":"run","class":"PHPUnit\\Framework\\TestSuite","object":{},"type":"->"},{"file":"phar:\/\/C:\/Users\/coyle\/Desktop\/Orange-Management\/phpunit.phar\/phpunit\/TextUI\/Command.php","line":195,"function":"doRun","class":"PHPUnit\\TextUI\\TestRunner","object":{},"type":"->"},{"file":"phar:\/\/C:\/Users\/coyle\/Desktop\/Orange-Management\/phpunit.phar\/phpunit\/TextUI\/Command.php","line":148,"function":"run","class":"PHPUnit\\TextUI\\Command","object":{},"type":"->"},{"file":"C:\\Users\\coyle\\Desktop\\Orange-Management\\phpunit.phar","line":566,"function":"main","class":"PHPUnit\\TextUI\\Command","type":"::"}]

View File

@ -55,7 +55,7 @@ class FileLoggerTest extends \PHPUnit\Framework\TestCase
unlink(__DIR__ . '/test.log');
}
$log = new FileLogger(__DIR__ . '/test.log');
$log = new FileLogger(__DIR__ . '/test.log', true);
$log->emergency(FileLogger::MSG_FULL, [
'message' => 'msg',
@ -124,6 +124,16 @@ class FileLoggerTest extends \PHPUnit\Framework\TestCase
self::assertEquals([5, 6, 7, 8, 9], array_keys($log->get(5, 1)));
self::assertEquals('alert', $log->getByLine(2)['level']);
ob_start();
$log->console(FileLogger::MSG_FULL, false, [
'message' => 'msg',
'line' => 11,
'file' => FileLoggerTest::class,
]);
$ob = ob_get_clean();
self::assertEquals(2, $log->countLogs()['info'] ?? 0);
self::assertTrue(stripos($ob, 'msg;') !== false);
ob_start();
$log->console('test', true);
$ob = ob_get_clean();
@ -134,6 +144,8 @@ class FileLoggerTest extends \PHPUnit\Framework\TestCase
if (file_exists(__DIR__ . '/' . date('Y-m-d') . '.log')) {
unlink(__DIR__ . '/' . date('Y-m-d') . '.log');
}
ob_clean();
}
/**

View File

@ -41,6 +41,7 @@ class FunctionsTest extends \PHPUnit\Framework\TestCase
{
self::assertEquals(4, Functions::invMod(3, -11));
self::assertEquals(12, Functions::invMod(10, 17));
self::assertEquals(5, Functions::invMod(-10, 17));
}
public function testAbs()

View File

@ -19,16 +19,23 @@ class PolygonTest extends \PHPUnit\Framework\TestCase
{
public function testPoint()
{
$polygon = new Polygon([
$polyArray = [
['x' => 1, 'y' => 1],
['x' => 1, 'y' => 2],
['x' => 2, 'y' => 2],
['x' => 2, 'y' => 1],
]);
];
$polygon = new Polygon($polyArray);
self::assertEquals(-1, $polygon->pointInPolygon(['x' => 1.5, 'y' => 1.5]));
self::assertEquals(1, $polygon->pointInPolygon(['x' => 4.9, 'y' => 1.2]));
self::assertEquals(-1, $polygon->pointInPolygon(['x' => 1.8, 'y' => 1.1]));
self::assertEquals(-1, Polygon::isPointInPolygon(['x' => 1.5, 'y' => 1.5], $polyArray));
self::assertEquals(1, Polygon::isPointInPolygon(['x' => 4.9, 'y' => 1.2], $polyArray));
self::assertEquals(0, Polygon::isPointInPolygon(['x' => 1, 'y' => 2], $polyArray));
self::assertEquals(-1, Polygon::isPointInPolygon(['x' => 1.8, 'y' => 1.1], $polyArray));
}
public function testAngle()

View File

@ -0,0 +1,59 @@
<?php
/**
* Orange Management
*
* PHP Version 7.1
*
* @package TBD
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link http://website.orange-management.de
*/
namespace phpOMS\tests\Message;
require_once __DIR__ . '/../Autoloader.php';
use phpOMS\Message\HeaderAbstract;
class HeaderAbstractTest extends \PHPUnit\Framework\TestCase
{
protected $header = null;
protected function setUp()
{
$this->header = new class extends HeaderAbstract
{
public function generate(int $statusCode) /* : void */
{
}
public function getProtocolVersion() : string
{
return '1';
}
public function set(string $key, string $value, bool $overwrite = false) /* : void */
{
}
public function get(string $key) : array
{
return [];
}
public function has(string $key) : bool
{
return true;
}
};
}
public function testSetGet()
{
$this->header->setStatusCode(2);
self::assertEquals(2, $this->header->getStatusCode());
}
}

View File

@ -16,6 +16,8 @@ namespace phpOMS\tests\Message\Http;
use phpOMS\Message\Http\Header;
use phpOMS\Localization\Localization;
use phpOMS\Message\Http\RequestStatusCode;
use phpOMS\DataStorage\LockException;
use phpOMS\Utils\TestUtils;
class HeaderTest extends \PHPUnit\Framework\TestCase
{
@ -65,6 +67,38 @@ class HeaderTest extends \PHPUnit\Framework\TestCase
self::AssertEquals(2, $header->getAccount(2));
}
/**
* @expectedException phpOMS\DataStorage\LockException
*/
public function testLockedHeaderSet()
{
try {
$header = new Header();
Header::lock();
self::assertTrue(Header::isLocked());
$header->set('key', 'value');
} finally {
TestUtils::setMember('phpOMS\Message\Http\Header', 'isLocked', false);
}
}
/**
* @expectedException phpOMS\DataStorage\LockException
*/
public function testLockedHeaderRemove()
{
try {
$header = new Header();
Header::lock();
self::assertTrue(Header::isLocked());
$header->remove('key');
} finally {
TestUtils::setMember('phpOMS\Message\Http\Header', 'isLocked', false);
}
}
public function testGeneration()
{
$header = new Header();

View File

@ -45,6 +45,8 @@ class RequestTest extends \PHPUnit\Framework\TestCase
self::assertInstanceOf('\phpOMS\Message\Http\Header', $request->getHeader());
self::assertInstanceOf('\phpOMS\Message\Http\Request', Request::createFromSuperglobals());
self::assertEquals('http://', $request->__toString());
self::assertFalse($request->hasData('key'));
self::assertEquals(null, $request->getData('key'));
}
public function testSetGet()
@ -84,6 +86,7 @@ class RequestTest extends \PHPUnit\Framework\TestCase
self::assertTrue($request->setData('key', 'value'));
self::assertFalse($request->setData('key', 'value2', false));
self::assertEquals('value', $request->getData('key'));
self::assertTrue($request->hasData('key'));
self::assertEquals(['key' => 'value'], $request->getData());
$request->setRequestSource(RequestSource::SOCKET);
@ -112,4 +115,14 @@ class RequestTest extends \PHPUnit\Framework\TestCase
$request = new Request(new Http('http://www.google.com/test/path'));
$request->isHttps(-1);
}
/**
* @expectedException \Exception
*/
public function testInvalidRouteVerb()
{
$request = new Request(new Http('http://www.google.com/test/path'));
$request->setMethod('failure');
$request->getRouteVerb();
}
}

View File

@ -0,0 +1,53 @@
<?php
/**
* Orange Management
*
* PHP Version 7.1
*
* @package TBD
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link http://website.orange-management.de
*/
namespace phpOMS\tests\Message;
require_once __DIR__ . '/../Autoloader.php';
use phpOMS\Message\ResponseAbstract;
class ResponseAbstractTest extends \PHPUnit\Framework\TestCase
{
protected $response = null;
protected function setUp()
{
$this->response = new class extends ResponseAbstract
{
public function toArray() : array
{
return [1];
}
public function getBody() : string
{
return '';
}
};
}
public function testDefault()
{
self::assertEquals(null, $this->response->get('asdf'));
self::assertEquals('', $this->response->getBody());
}
public function testSetGet()
{
self::assertEquals([1], $this->response->jsonSerialize());
$this->response->set('asdf', false);
self::assertEquals(false, $this->response->get('asdf'));
}
}

View File

@ -14,6 +14,7 @@
namespace phpOMS\tests\Model\Html;
use phpOMS\Model\Html\Head;
use phpOMS\Asset\AssetType;
class HeadTest extends \PHPUnit\Framework\TestCase
{
@ -31,4 +32,36 @@ class HeadTest extends \PHPUnit\Framework\TestCase
self::assertEquals('', $head->renderAssetsLate());
self::assertEquals('<meta name="generator" content="Orange Management">', $head->render());
}
public function testSetGet()
{
$head = new Head();
$head->setTitle('my title');
self::assertEquals('my title', $head->getTitle());
$head->addAsset(AssetType::CSS, '/path/styles.css');
$head->addAsset(AssetType::JS, '/path/logic.js');
$head->addAsset(AssetType::JSLATE, '/path/late.js');
$head->setStyle('base', '#test .class { color: #000; }');
self::assertEquals(['base' => '#test .class { color: #000; }'], $head->getStyleAll());
$head->setScript('key', 'console.log("msg");');
self::assertEquals(['key' => 'console.log("msg");'], $head->getScriptAll());
$head->setLanguage('en');
self::assertEquals('en', $head->getLanguage());
self::assertEquals(
'<meta name="generator" content="Orange Management">'
. '<link rel="stylesheet" type="text/css" href="/path/styles.css">'
. '<script src="/path/logic.js"></script>'
. '<style>#test .class { color: #000; }</style>'
. '<script>console.log("msg");</script>',
$head->render()
);
self::assertEquals('<script src="/path/late.js"></script>', $head->renderAssetsLate());
}
}

View File

@ -26,4 +26,21 @@ class MetaTest extends \PHPUnit\Framework\TestCase
self::assertEquals([], $meta->getKeywords());
self::assertEquals('<meta name="generator" content="Orange Management">', $meta->render());
}
public function testGetSet()
{
$meta = new Meta();
$meta->addKeyword('orange');
self::assertEquals(['orange'], $meta->getKeywords());
$meta->setAuthor('oms');
self::assertEquals('oms', $meta->getAuthor());
$meta->setCharset('utf-8');
self::assertEquals('utf-8', $meta->getCharset());
$meta->setDescription('some description');
self::assertEquals('some description', $meta->getDescription());
}
}

View File

@ -21,10 +21,10 @@ class InfoManagerTest extends \PHPUnit\Framework\TestCase
{
public function testInfoManager()
{
$info = new InfoManager(__Dir__ . '/info-test.json');
$info = new InfoManager(__DIR__ . '/info-test.json');
$info->load();
$jarray = json_decode(file_get_contents(__Dir__ . '/info-test.json'), true);
$jarray = json_decode(file_get_contents(__DIR__ . '/info-test.json'), true);
self::assertEquals($jarray, $info->get());
self::assertEquals($jarray['name']['internal'], $info->getInternalName());
@ -35,12 +35,13 @@ class InfoManagerTest extends \PHPUnit\Framework\TestCase
self::assertEquals($jarray['directory'], $info->getDirectory());
self::assertEquals($jarray['version'], $info->getVersion());
self::assertEquals($jarray['load'], $info->getLoad());
self::assertEquals(__DIR__ . '/info-test.json', $info->getPath());
$info->set('/name/internal', 'ABC');
self::assertEquals('ABC', $info->getInternalName());
$info->update();
$info2 = new InfoManager(__Dir__ . '/info-test.json');
$info2 = new InfoManager(__DIR__ . '/info-test.json');
$info2->load();
self::assertEquals($info->getInternalName(), $info2->getInternalName());
@ -53,7 +54,7 @@ class InfoManagerTest extends \PHPUnit\Framework\TestCase
*/
public function testInvalidPathLoad()
{
$info = new InfoManager(__Dir__ . '/invalid.json');
$info = new InfoManager(__DIR__ . '/invalid.json');
$info->load();
}
@ -62,7 +63,7 @@ class InfoManagerTest extends \PHPUnit\Framework\TestCase
*/
public function testInvalidPathUpdate()
{
$info = new InfoManager(__Dir__ . '/invalid.json');
$info = new InfoManager(__DIR__ . '/invalid.json');
$info->update();
}
@ -71,7 +72,7 @@ class InfoManagerTest extends \PHPUnit\Framework\TestCase
*/
public function testInvalidDataSet()
{
$info = new InfoManager(__Dir__ . '/info-test.json');
$info = new InfoManager(__DIR__ . '/info-test.json');
$info->load();
$testObj = new class {

View File

@ -75,4 +75,13 @@ class RouterTest extends \PHPUnit\Framework\TestCase
$router->route('http://test.com/backends/admin/settings/general/something?test', RouteVerb::GET)
);
}
/**
* @expectedException \InvalidArgumentException
*/
public function testInvalidRequestType()
{
$router = new Router();
$router->route([]);
}
}

View File

@ -0,0 +1,65 @@
<?php
/**
* Orange Management
*
* PHP Version 7.1
*
* @package TBD
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link http://website.orange-management.de
*/
namespace phpOMS\tests\Security;
require_once __DIR__ . '/../Autoloader.php';
use phpOMS\Security\PhpCode;
class RouteVerbTest extends \PHPUnit\Framework\TestCase
{
public function testHasUnicode()
{
self::assertTrue(
PhpCode::hasUnicode(
PhpCode::normalizeSource(
file_get_contents(__DIR__ . '/Sample/hasUnicode.php')
)
)
);
self::assertFalse(
PhpCode::hasUnicode(
PhpCode::normalizeSource(
file_get_contents(__DIR__ . '/Sample/noUnicode.php')
)
)
);
}
public function testDisabledFunctions()
{
self::assertFalse(PhpCode::isDisabled(['file_get_contents']));
self::assertFalse(PhpCode::isDisabled(['eval', 'file_get_contents']));
}
public function testHasDeprecatedFunction()
{
self::assertTrue(
PhpCode::hasDeprecatedFunction(
PhpCode::normalizeSource(
file_get_contents(__DIR__ . '/Sample/hasDeprecated.php')
)
)
);
self::assertFalse(
PhpCode::hasDeprecatedFunction(
PhpCode::normalizeSource(
file_get_contents(__DIR__ . '/Sample/noDeprecated.php')
)
)
);
}
}

View File

@ -0,0 +1,6 @@
<?php
function hasDeprecated()
{
return eval('1 === 1');
}

View File

@ -0,0 +1,6 @@
<?php
function has𠀊Unicode()
{
return true;
}

View File

@ -0,0 +1,6 @@
<?php
function noDeprecated()
{
return is_string('');
}

View File

@ -0,0 +1,6 @@
<?php
function noUnicode()
{
return true;
}

View File

@ -117,4 +117,15 @@ class ArrayUtilsTest extends \PHPUnit\Framework\TestCase
self::assertTrue(ArrayUtils::anyInArray($numArr, [2, 6, 8]));
self::assertFalse(ArrayUtils::anyInArray($numArr, [10, 22]));
}
public function testArg()
{
self::assertEquals(null, ArrayUtils::hasArg('--testNull', $_SERVER['argv']));
self::assertEquals(null, ArrayUtils::getArg('--testNull', $_SERVER['argv']));
if (ArrayUtils::getArg('--configuration', $_SERVER['argv']) !== null) {
self::assertGreaterThan(0, ArrayUtils::hasArg('--configuration', $_SERVER['argv']));
self::assertTrue(stripos(ArrayUtils::getArg('--configuration', $_SERVER['argv']), '.xml') !== false);
}
}
}

View File

@ -33,4 +33,41 @@ class CommitTest extends \PHPUnit\Framework\TestCase
self::assertInstanceOf('\phpOMS\Utils\Git\Repository', $commit->getRepository());
self::assertInstanceOf('\DateTime', $commit->getDate());
}
public function testGetSet()
{
$commit = new Commit();
self::assertTrue($commit->addFile('/some/file/path'));
self::assertFalse($commit->addFile('/some/file/path'));
self::assertTrue($commit->addFile('/some/file/path2'));
self::assertEquals([
'/some/file/path' => [],
'/some/file/path2' => []
], $commit->getFiles());
self::assertFalse($commit->removeFile('/some/file/path3'));
self::assertTrue($commit->removeFile('/some/file/path'));
self::assertEquals([
'/some/file/path2' => []
], $commit->getFiles());
$commit->setMessage('My Message');
self::assertEquals('My Message', $commit->getMessage());
$commit->setAuthor(new Author('Orange'));
self::assertEquals('Orange', $commit->getAuthor()->getName());
$commit->setBranch(new Branch('develop'));
self::assertEquals('develop', $commit->getBranch()->getName());
$commit->setTag(new Tag('1.0.0'));
self::assertEquals('1.0.0', $commit->getTag()->getName());
$commit->setDate($date = new \DateTime('now'));
self::assertEquals($date->format('Y-m-d'), $commit->getDate()->format('Y-m-d'));
$commit->setRepository(new Repository(realpath(__DIR__ . '/../../../')));
self::assertEquals(realpath(__DIR__ . '/../../../'), $commit->getRepository()->getPath());
}
}

View File

@ -22,5 +22,6 @@ class RepositoryTest extends \PHPUnit\Framework\TestCase
$repo = new Repository(realpath(__DIR__ . '/../../../'));
self::assertTrue('phpOMS' === $repo->getName() || 'build' === $repo->getName());
self::assertEquals(str_replace('\\', '/', realpath(__DIR__ . '/../../../.git')), str_replace('\\', '/', $repo->getDirectoryPath()));
self::assertEquals(realpath(__DIR__ . '/../../../'), $repo->getPath());
}
}

View File

@ -39,5 +39,15 @@ class ValidatorTest extends \PHPUnit\Framework\TestCase
Validator::resetError();
self::assertEquals('', Validator::getMessage());
self::assertEquals(0, Validator::getErrorCode());
self::assertTrue(Validator::isValid('testVar'));
self::assertTrue(Validator::isValid('value', ['\is_string' => []]));
self::assertFalse(Validator::isValid('value', ['\is_stringNot' => []]));
self::assertTrue(Validator::isValid('value', ['phpOMS\Validation\Validator::hasLength' => [4]]));
self::assertTrue(Validator::matches('ThisTestVar', '/.*/'));
self::assertFalse(Validator::matches('ThisTestVar', '/.*\d+/'));
self::assertTrue(Validator::matches('ThisTestVar', '/TestVar/'));
self::assertFalse(Validator::matches('ThisTestVar', '/ThisTest$/'));
}
}

View File

@ -22,6 +22,7 @@ use phpOMS\Message\Http\Request;
use phpOMS\Message\Http\Response;
use phpOMS\Uri\Http;
use phpOMS\Views\View;
use phpOMS\Views\ViewAbstract;
use phpOMS\Localization\L11nManager;
class ViewTest extends \PHPUnit\Framework\TestCase
@ -60,7 +61,7 @@ class ViewTest extends \PHPUnit\Framework\TestCase
public function testGetText()
{
$view = new View($this->app, $request = new Request(new Http('')), $response = new Response(new Localization()));
$view = new View($this->app, $request = new Request(new Http('')), $response = new Response());
$view->setTemplate('/Modules/Admin/Theme/Backend/accounts-list');
$expected = [
@ -80,7 +81,7 @@ class ViewTest extends \PHPUnit\Framework\TestCase
public function testGetSet()
{
$view = new View($this->app, $request = new Request(new Http('')), $response = new Response(new Localization()));
$view = new View($this->app, $request = new Request(new Http('')), $response = new Response());
$view->setData('key', 'value');
self::assertEquals('value', $view->getData('key'));
@ -96,6 +97,7 @@ class ViewTest extends \PHPUnit\Framework\TestCase
self::assertEquals($response, $view->getResponse());
self::assertEquals('&lt;a href=&quot;test&quot;&gt;Test&lt;/a&gt;', $view->printHtml('<a href="test">Test</a>'));
self::assertEquals('&lt;a href=&quot;test&quot;&gt;Test&lt;/a&gt;', ViewAbstract::html('<a href="test">Test</a>'));
$tView = new View($this->app, $request, $response);
self::assertTrue($view->addView('test', $tView));
@ -108,7 +110,7 @@ class ViewTest extends \PHPUnit\Framework\TestCase
public function testRender()
{
$view = new View($this->app, new Request(), new Response(new Localization()));
$view = new View($this->app, new Request(), new Response());
$view->setTemplate('/phpOMS/tests/Views/testTemplate');
self::assertEquals('<strong>Test</strong>', $view->render());
@ -123,7 +125,7 @@ class ViewTest extends \PHPUnit\Framework\TestCase
*/
public function testRenderException()
{
$view = new View($this->app, new Request(new Http('')), new Response(new Localization()));
$view = new View($this->app, new Request(new Http('')), new Response());
$view->setTemplate('something.txt');
$view->render();
@ -134,7 +136,7 @@ class ViewTest extends \PHPUnit\Framework\TestCase
*/
public function testSerializeException()
{
$view = new View($this->app, new Request(new Http('')), new Response(new Localization()));
$view = new View($this->app, new Request(new Http('')), new Response());
$view->setTemplate('something.txt');
$view->serialize();