diff options
Diffstat (limited to 'tests/Unit')
-rw-r--r-- | tests/Unit/HelpersTest.php | 24 |
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() |