summaryrefslogtreecommitdiff
path: root/tests/Unit/Http/Validation/ValidationServiceProviderTest.php
blob: 969f43512eaf12c848e0fbf41c2a13e6f6928570 (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
<?php

namespace Engelsystem\Test\Unit\Http\Validation;

use Engelsystem\Application;
use Engelsystem\Http\Validation\ValidationServiceProvider;
use Engelsystem\Http\Validation\Validator;
use Engelsystem\Test\Unit\Http\Validation\Stub\ValidatesRequestImplementation;
use Engelsystem\Test\Unit\ServiceProviderTest;
use stdClass;

class ValidationServiceProviderTest extends ServiceProviderTest
{
    /**
     * @covers \Engelsystem\Http\Validation\ValidationServiceProvider::register
     */
    public function testRegister()
    {
        $app = new Application();

        $serviceProvider = new ValidationServiceProvider($app);
        $serviceProvider->register();

        $this->assertTrue($app->has(Validator::class));
        $this->assertTrue($app->has('validator'));

        /** @var ValidatesRequestImplementation $validatesRequest */
        $validatesRequest = $app->make(ValidatesRequestImplementation::class);
        $this->assertTrue($validatesRequest->hasValidator());

        // Test afterResolving early return
        $app->make(stdClass::class);
    }
}