Basics of auth
Some checks failed
🧪✨ Tests Workflow / 🛡️ 🔒 License Check (push) Successful in 54s
🧪✨ Tests Workflow / 🧪 ✨ Database Migrations (push) Failing after 1m4s
🧪✨ Tests Workflow / 🛡️ 🔒 Library Audit (push) Successful in 1m14s
🧪✨ Tests Workflow / 📝 ✨ Code Lint (push) Successful in 1m10s
🧪✨ Tests Workflow / 🐙 🔍 Code Sniffer (push) Successful in 1m19s
🧪✨ Tests Workflow / 🧪 ✅ Unit Tests (push) Failing after 1m12s

This commit is contained in:
2026-01-02 15:01:26 -05:00
parent b5b6caa400
commit fc6e493355
21 changed files with 51 additions and 189 deletions

View File

@@ -6,16 +6,16 @@ namespace Siteworxpro\Tests\CommandBus;
use League\Tactician\Exception\CanNotInvokeHandlerException;
use Siteworxpro\App\CommandBus\AttributeLocator;
use Siteworxpro\App\CommandBus\Commands\ExampleCommand;
use Siteworxpro\App\CommandBus\Handlers\ExampleHandler;
use Siteworxpro\Tests\Unit;
class AttributeLocatorTest extends Unit
{
private const array HANDLERS = [
ExampleCommand::class => ExampleHandler::class,
];
/**
* @return void
*/
public function testResolvesFiles(): void
{
$attributeLocator = new AttributeLocator();

View File

@@ -1,32 +0,0 @@
<?php
namespace Siteworxpro\Tests\CommandBus\Handlers;
use Siteworxpro\App\CommandBus\Commands\Command;
use Siteworxpro\App\CommandBus\Commands\ExampleCommand;
use Siteworxpro\App\CommandBus\Handlers\ExampleHandler;
use Siteworxpro\Tests\Unit;
class ExampleHandlerTest extends Unit
{
public function testExampleCommand(): void
{
$command = new ExampleCommand('test payload');
$this->assertEquals('test payload', $command->getName());
$handler = new ExampleHandler();
$result = $handler($command);
$this->assertEquals('Hello, test payload!', $result);
}
public function testThrowsException(): void
{
$class = new readonly class extends Command
{
};
$this->expectException(\TypeError::class);
$handler = new ExampleHandler();
$handler($class);
}
}

View File

@@ -1,48 +0,0 @@
<?php
declare(strict_types=1);
namespace Siteworxpro\Tests\Controllers;
use League\Tactician\CommandBus;
use Siteworxpro\App\Controllers\IndexController;
class IndexControllerTest extends AbstractController
{
/**
* @throws \JsonException|\ReflectionException
*/
public function testGet(): void
{
$this->assertTrue(true);
$this->getContainer()->bind(CommandBus::class, function () {
return \Mockery::mock(CommandBus::class)
->shouldReceive('handle')
->andReturn('Hello World')
->getMock();
});
$controller = new IndexController();
$response = $controller->get($this->getMockRequest());
$this->assertEquals(200, $response->getStatusCode());
$this->assertEquals('{"message":"Server is running. Hello World"}', (string)$response->getBody());
}
/**
* @throws \JsonException
*/
public function testPost(): void
{
$this->assertTrue(true);
$controller = new IndexController();
$response = $controller->post($this->getMockRequest());
$this->assertEquals(200, $response->getStatusCode());
$this->assertEquals('{"message":"POST request received"}', (string)$response->getBody());
}
}

View File

@@ -14,6 +14,6 @@ class UlidTest extends Unit
{
$ulid = Ulid::generate();
$this->assertIsString($ulid);
$this->assertEquals(16, strlen($ulid));
$this->assertEquals(26, strlen($ulid));
}
}