You've already forked Php-Template
more tests (#19)
All checks were successful
🧪✨ Tests Workflow / 🛡️ 🔒 Library Audit (push) Successful in 2m32s
🧪✨ Tests Workflow / 🧪 ✨ Database Migrations (push) Successful in 2m48s
🧪✨ Tests Workflow / 🛡️ 🔒 License Check (push) Successful in 2m33s
🧪✨ Tests Workflow / 📝 ✨ Code Lint (push) Successful in 2m44s
🧪✨ Tests Workflow / 🐙 🔍 Code Sniffer (push) Successful in 2m53s
🧪✨ Tests Workflow / 🧪 ✅ Unit Tests (push) Successful in 3m5s
All checks were successful
🧪✨ Tests Workflow / 🛡️ 🔒 Library Audit (push) Successful in 2m32s
🧪✨ Tests Workflow / 🧪 ✨ Database Migrations (push) Successful in 2m48s
🧪✨ Tests Workflow / 🛡️ 🔒 License Check (push) Successful in 2m33s
🧪✨ Tests Workflow / 📝 ✨ Code Lint (push) Successful in 2m44s
🧪✨ Tests Workflow / 🐙 🔍 Code Sniffer (push) Successful in 2m53s
🧪✨ Tests Workflow / 🧪 ✅ Unit Tests (push) Successful in 3m5s
Reviewed-on: #19 Co-authored-by: Ron Rise <ron@siteworxpro.com> Co-committed-by: Ron Rise <ron@siteworxpro.com>
This commit was merged in pull request #19.
This commit is contained in:
47
tests/Events/Listeners/ConnectedTest.php
Normal file
47
tests/Events/Listeners/ConnectedTest.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Siteworxpro\Tests\Events\Listeners;
|
||||
|
||||
use Illuminate\Database\Events\ConnectionEstablished;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
use Psr\Log\LogLevel;
|
||||
use Siteworxpro\App\Events\Listeners\Database\Connected;
|
||||
use Siteworxpro\App\Log\Logger;
|
||||
use Siteworxpro\Tests\Unit;
|
||||
|
||||
class ConnectedTest extends Unit
|
||||
{
|
||||
/**
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws \ReflectionException
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$inputBuffer = fopen('php://memory', 'r+');
|
||||
$logger = new Logger(LogLevel::DEBUG, $inputBuffer);
|
||||
\Siteworxpro\App\Services\Facades\Logger::getFacadeContainer()->bind(Logger::class, fn() => $logger);
|
||||
}
|
||||
|
||||
public function testHandlesEvent()
|
||||
{
|
||||
$this->expectNotToPerformAssertions();
|
||||
|
||||
$connectedEvent = $this->createMock(ConnectionEstablished::class);
|
||||
$listener = new Connected();
|
||||
|
||||
$listener->__invoke($connectedEvent);
|
||||
}
|
||||
|
||||
public function testThrowsException()
|
||||
{
|
||||
$this->expectException(\TypeError::class);
|
||||
$listener = new Connected();
|
||||
$listener->__invoke(new \stdClass());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user