summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorIgor Scheller <igor.scheller@igorshp.de>2018-10-08 21:15:56 +0200
committermsquare <msquare@notrademark.de>2018-10-31 13:43:23 +0100
commit2dcb7cc2de448c664bbc9a7112f9cb13dc15c516 (patch)
treee409cf77e97c91ff27b0e61f2a982519fdfdf76f /tests
parentd15946df2dfb0ae2f0ca9371e5c8071df91ab45a (diff)
Replaced some global `$user` variables
Diffstat (limited to 'tests')
-rw-r--r--tests/Unit/HelpersTest.php24
1 files changed, 23 insertions, 1 deletions
diff --git a/tests/Unit/HelpersTest.php b/tests/Unit/HelpersTest.php
index b36abc64..e0184b86 100644
--- a/tests/Unit/HelpersTest.php
+++ b/tests/Unit/HelpersTest.php
@@ -5,11 +5,12 @@ namespace Engelsystem\Test\Unit;
use Engelsystem\Application;
use Engelsystem\Config\Config;
use Engelsystem\Container\Container;
+use Engelsystem\Helpers\Authenticator;
use Engelsystem\Helpers\Translator;
use Engelsystem\Http\Request;
use Engelsystem\Http\Response;
-use Engelsystem\Renderer\Renderer;
use Engelsystem\Http\UrlGeneratorInterface;
+use Engelsystem\Renderer\Renderer;
use PHPUnit\Framework\TestCase;
use PHPUnit_Framework_MockObject_MockObject as MockObject;
use Symfony\Component\HttpFoundation\Session\Session;
@@ -33,6 +34,27 @@ class HelpersTest extends TestCase
}
/**
+ * @covers \auth
+ */
+ public function testAuth()
+ {
+ /** @var Application|MockObject $app */
+ $app = $this->createMock(Container::class);
+ Application::setInstance($app);
+ /** @var Authenticator|MockObject $auth */
+ $auth = $this->getMockBuilder(Authenticator::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+
+ $app->expects($this->once())
+ ->method('get')
+ ->with('authenticator')
+ ->willReturn($auth);
+
+ $this->assertEquals($auth, auth());
+ }
+
+ /**
* @covers \base_path()
*/
public function testBasePath()