You've already forked Traefik-Redis-Api
76 lines
1.7 KiB
PHP
76 lines
1.7 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Siteworxpro\Tests\Controllers;
|
|
|
|
use League\Route\Http\Exception\NotFoundException;
|
|
use Nyholm\Psr7\ServerRequest;
|
|
use PHPUnit\Framework\MockObject\Exception;
|
|
use Psr\Log\LoggerInterface;
|
|
use Siteworxpro\App\Controllers\Controller;
|
|
use Siteworxpro\App\Facades\Logger;
|
|
use Siteworxpro\App\Traefik\ProtocolEnum;
|
|
use Siteworxpro\Tests\Unit;
|
|
|
|
class ControllerTest extends Unit
|
|
{
|
|
/**
|
|
* @throws NotFoundException
|
|
*/
|
|
public function testGet(): void
|
|
{
|
|
$fooController = new FooController();
|
|
$request = new ServerRequest('GET', '/foo');
|
|
|
|
$this->expectException(NotFoundException::class);
|
|
|
|
$fooController->get($request);
|
|
}
|
|
|
|
/**
|
|
* @throws NotFoundException
|
|
*/
|
|
public function testPost(): void
|
|
{
|
|
$fooController = new FooController();
|
|
$request = new ServerRequest('GET', '/foo');
|
|
|
|
$this->expectException(NotFoundException::class);
|
|
|
|
$fooController->post($request);
|
|
}
|
|
|
|
/**
|
|
* @throws NotFoundException
|
|
*/
|
|
public function testDelete(): void
|
|
{
|
|
$fooController = new FooController();
|
|
$request = new ServerRequest('GET', '/foo');
|
|
|
|
$this->expectException(NotFoundException::class);
|
|
|
|
$fooController->delete($request);
|
|
}
|
|
|
|
/**
|
|
* @throws NotFoundException
|
|
*/
|
|
public function testPatch(): void
|
|
{
|
|
$fooController = new FooController();
|
|
$request = new ServerRequest('GET', '/foo');
|
|
|
|
$this->expectException(NotFoundException::class);
|
|
|
|
$fooController->patch($request);
|
|
}
|
|
}
|
|
|
|
// This is a dummy controller for testing purposes
|
|
// @codingStandardsIgnoreLine
|
|
class FooController extends Controller
|
|
{
|
|
}
|