summaryrefslogtreecommitdiff
path: root/tests/Unit/Exceptions/HandlerTest.php
blob: 29759be7531179ea582df5f5dac52c175f7139e2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php

namespace Engelsystem\Test\Unit\Exceptions;

use Engelsystem\Exceptions\Handler;
use PHPUnit\Framework\TestCase;
use PHPUnit_Framework_MockObject_MockObject as Mock;

class HandlerTest extends TestCase
{
    /**
     * @covers \Engelsystem\Exceptions\Handler::__construct()
     * @covers \Engelsystem\Exceptions\Handler::register()
     */
    public function testRegister()
    {
        /** @var Handler|Mock $handler */
        $handler = $this->getMockForAbstractClass(Handler::class);
        $this->assertInstanceOf(Handler::class, $handler);
        $handler->register();
    }

    /**
     * @covers \Engelsystem\Exceptions\Handler::setEnvironment()
     * @covers \Engelsystem\Exceptions\Handler::getEnvironment()
     */
    public function testEnvironment()
    {
        /** @var Handler|Mock $handler */
        $handler = $this->getMockForAbstractClass(Handler::class);

        $handler->setEnvironment(Handler::ENV_DEVELOPMENT);
        $this->assertEquals(Handler::ENV_DEVELOPMENT, $handler->getEnvironment());

        $handler->setEnvironment(Handler::ENV_PRODUCTION);
        $this->assertEquals(Handler::ENV_PRODUCTION, $handler->getEnvironment());
    }
}