Added tests for base_path and config_path
This commit is contained in:
parent
411ea5bb6d
commit
e15e863625
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace Engelsystem\Test\Database;
|
||||
namespace Engelsystem\Test\Feature\Database;
|
||||
|
||||
use Engelsystem\Application;
|
||||
use Engelsystem\Config\Config;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace Engelsystem\Test\Logger;
|
||||
namespace Engelsystem\Test\Feature\Logger;
|
||||
|
||||
use Engelsystem\Logger\EngelsystemLogger;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace Engelsystem\Test;
|
||||
namespace Engelsystem\Test\Feature\Model;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Psr\Log\LogLevel;
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace Engelsystem\Test;
|
||||
namespace Engelsystem\Test\Feature\Model;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace Engelsystem\Test\Config;
|
||||
namespace Engelsystem\Test\Unit;
|
||||
|
||||
use Engelsystem\Application;
|
||||
use Engelsystem\Config\Config;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace Engelsystem\Test\Config;
|
||||
namespace Engelsystem\Test\Unit\Config;
|
||||
|
||||
use Engelsystem\Application;
|
||||
use Engelsystem\Config\Config;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace Engelsystem\Test\Config;
|
||||
namespace Engelsystem\Test\Unit\Config;
|
||||
|
||||
use Engelsystem\Config\Config;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace Engelsystem\Test\Database;
|
||||
namespace Engelsystem\Test\Unit\Database;
|
||||
|
||||
use Engelsystem\Config\Config;
|
||||
use Engelsystem\Database\DatabaseServiceProvider;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace Engelsystem\Test\Exceptions;
|
||||
namespace Engelsystem\Test\Unit\Exceptions;
|
||||
|
||||
use Engelsystem\Exceptions\ExceptionsServiceProvider;
|
||||
use Engelsystem\Exceptions\Handler as ExceptionHandler;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace Engelsystem\Test\Config;
|
||||
namespace Engelsystem\Test\Unit;
|
||||
|
||||
use Engelsystem\Application;
|
||||
use Engelsystem\Config\Config;
|
||||
|
@ -9,6 +9,7 @@ use Engelsystem\Http\Request;
|
|||
use Engelsystem\Renderer\Renderer;
|
||||
use Engelsystem\Routing\UrlGenerator;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use PHPUnit_Framework_MockObject_MockObject as MockObject;
|
||||
use Symfony\Component\HttpFoundation\Session\Session;
|
||||
|
||||
class HelpersTest extends TestCase
|
||||
|
@ -28,6 +29,25 @@ class HelpersTest extends TestCase
|
|||
$this->assertEquals($class, app('some.name'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \base_path()
|
||||
*/
|
||||
public function testBasePath()
|
||||
{
|
||||
/** @var MockObject|Application $app */
|
||||
$app = $this->getMockBuilder(Container::class)
|
||||
->getMock();
|
||||
Application::setInstance($app);
|
||||
|
||||
$app->expects($this->atLeastOnce())
|
||||
->method('get')
|
||||
->with('path')
|
||||
->willReturn('/foo/bar');
|
||||
|
||||
$this->assertEquals('/foo/bar', base_path());
|
||||
$this->assertEquals('/foo/bar/bla-foo.conf', base_path('bla-foo.conf'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \config
|
||||
*/
|
||||
|
@ -53,6 +73,25 @@ class HelpersTest extends TestCase
|
|||
$this->assertEquals(['user' => 'FooBar'], config('mail'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \config_path()
|
||||
*/
|
||||
public function testConfigPath()
|
||||
{
|
||||
/** @var MockObject|Application $app */
|
||||
$app = $this->getMockBuilder(Container::class)
|
||||
->getMock();
|
||||
Application::setInstance($app);
|
||||
|
||||
$app->expects($this->atLeastOnce())
|
||||
->method('get')
|
||||
->with('path.config')
|
||||
->willReturn('/foo/conf');
|
||||
|
||||
$this->assertEquals('/foo/conf', config_path());
|
||||
$this->assertEquals('/foo/conf/bar.php', config_path('bar.php'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \env
|
||||
*/
|
||||
|
@ -146,7 +185,7 @@ class HelpersTest extends TestCase
|
|||
/**
|
||||
* @param string $alias
|
||||
* @param object $object
|
||||
* @return Application|\PHPUnit_Framework_MockObject_MockObject
|
||||
* @return Application|MockObject
|
||||
*/
|
||||
protected function getAppMock($alias, $object)
|
||||
{
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace Engelsystem\Test\Logger;
|
||||
namespace Engelsystem\Test\Unit\Logger;
|
||||
|
||||
use Engelsystem\Logger\EngelsystemLogger;
|
||||
use Engelsystem\Logger\LoggerServiceProvider;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace Engelsystem\Test\Config;
|
||||
namespace Engelsystem\Test\Unit\Renderer;
|
||||
|
||||
use Engelsystem\Renderer\HtmlEngine;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace Engelsystem\Test\Logger;
|
||||
namespace Engelsystem\Test\Unit\Renderer;
|
||||
|
||||
use Engelsystem\Renderer\EngineInterface;
|
||||
use Engelsystem\Renderer\HtmlEngine;
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
<?php
|
||||
|
||||
namespace Engelsystem\Test\Config;
|
||||
namespace Engelsystem\Test\Unit\Renderer;
|
||||
|
||||
use Engelsystem\Renderer\EngineInterface;
|
||||
use Engelsystem\Renderer\Renderer;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use PHPUnit_Framework_MockObject_MockObject as MockObject;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class RendererTest extends TestCase
|
||||
|
@ -13,6 +14,7 @@ class RendererTest extends TestCase
|
|||
{
|
||||
$renderer = new Renderer();
|
||||
|
||||
/** @var MockObject|EngineInterface $nullRenderer */
|
||||
$nullRenderer = $this->getMockForAbstractClass(EngineInterface::class);
|
||||
|
||||
$nullRenderer->expects($this->atLeastOnce())
|
||||
|
@ -20,6 +22,7 @@ class RendererTest extends TestCase
|
|||
->willReturn(false);
|
||||
$renderer->addRenderer($nullRenderer);
|
||||
|
||||
/** @var MockObject|EngineInterface $mockRenderer */
|
||||
$mockRenderer = $this->getMockForAbstractClass(EngineInterface::class);
|
||||
|
||||
$mockRenderer->expects($this->atLeastOnce())
|
||||
|
@ -42,6 +45,7 @@ class RendererTest extends TestCase
|
|||
{
|
||||
$renderer = new Renderer();
|
||||
|
||||
/** @var MockObject|LoggerInterface $loggerMock */
|
||||
$loggerMock = $this->getMockForAbstractClass(LoggerInterface::class);
|
||||
$loggerMock
|
||||
->expects($this->once())
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace Engelsystem\Test\Routing;
|
||||
namespace Engelsystem\Test\Unit\Routing;
|
||||
|
||||
use Engelsystem\Routing\RoutingServiceProvider;
|
||||
use Engelsystem\Routing\UrlGenerator;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace Engelsystem\Test\Config;
|
||||
namespace Engelsystem\Test\Unit\Routing;
|
||||
|
||||
use Engelsystem\Application;
|
||||
use Engelsystem\Container\Container;
|
||||
|
|
Loading…
Reference in New Issue