engelsystem/tests/Unit/Http/Validation/ValidationServiceProviderTe...

37 lines
1.1 KiB
PHP
Raw Permalink Normal View History

2019-07-09 21:43:18 +02:00
<?php
declare(strict_types=1);
2019-07-09 21:43:18 +02:00
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(): void
2019-07-09 21:43:18 +02:00
{
$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);
}
}