Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Bridge/Telescope/TelescopeLogger.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

class TelescopeLogger implements LoggerInterface
{
private LoggerInterface $parentLogger;
private readonly LoggerInterface $parentLogger;

public function __construct($parentLogger)
{
Expand Down
6 changes: 3 additions & 3 deletions tests/app/Entities/Footprint.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@

final class Footprint implements JsonSerializable, Stringable
{
private UserId $id;
private readonly UserId $id;

private string $party;
private readonly string $party;

private string $realm;
private readonly string $realm;

public static function empty(string $authorizedParty = 'guest-party', string $realm = 'guest-realm'): self
{
Expand Down
4 changes: 2 additions & 2 deletions tests/app/Entities/Post.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ class Post
public int $id;

#[Column(type: 'string')]
private string $title;
private readonly string $title;

#[Column(type: 'text')]
private string $description;
private readonly string $description;

#[Column(type: 'datetime', nullable: true)]
private ?DateTimeImmutable $deletedAt = null;
Expand Down
2 changes: 1 addition & 1 deletion tests/app/Entities/UserId.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

final class UserId implements Stringable
{
private string $id;
private readonly string $id;

public static function create(string $userId): self
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,12 @@
use Cycle\Database\Database;
use Cycle\Database\DatabaseInterface;
use Illuminate\Support\Facades\Artisan;
use PHPUnit\Framework\Attributes\Test;
use WayOfDev\Tests\TestCase;

class ListCommandTest extends TestCase
{
/**
* @test
*/
#[Test]
public function it_runs_handle(): void
{
/** @var Database $database */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,12 @@
use Cycle\Database\Database;
use Cycle\Database\DatabaseInterface;
use Illuminate\Support\Facades\Artisan;
use PHPUnit\Framework\Attributes\Test;
use WayOfDev\Tests\TestCase;

class TableCommandTest extends TestCase
{
/**
* @test
*/
#[Test]
public function it_runs_handle(): void
{
/** @var Database $database */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,12 @@

use Cycle\Database\Database;
use Cycle\Database\DatabaseInterface;
use PHPUnit\Framework\Attributes\Test;
use WayOfDev\Tests\TestCase;

class InitCommandTest extends TestCase
{
/**
* @test
*/
#[Test]
public function it_runs_handle(): void
{
/** @var Database $database */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,12 @@

use Cycle\Database\Database;
use Cycle\Database\DatabaseInterface;
use PHPUnit\Framework\Attributes\Test;
use WayOfDev\Tests\TestCase;

class MigrateCommandTest extends TestCase
{
/**
* @test
*/
#[Test]
public function it_migrates_in_safe_environment(): void
{
/** @var Database $database */
Expand All @@ -27,9 +26,7 @@ public function it_migrates_in_safe_environment(): void
$this::assertCount(1, $database->getTables());
}

/**
* @test
*/
#[Test]
public function it_migrates_in_production_with_force_option(): void
{
// Set the application environment to production
Expand All @@ -50,9 +47,7 @@ public function it_migrates_in_production_with_force_option(): void
$this::assertCount(4, $database->getTables());
}

/**
* @test
*/
#[Test]
public function it_warns_about_unsafe_migrations(): void
{
// Set the application environment to production
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,12 @@

use Cycle\Database\Database;
use Cycle\Database\DatabaseInterface;
use PHPUnit\Framework\Attributes\Test;
use WayOfDev\Tests\TestCase;

class ReplayCommandTest extends TestCase
{
/**
* @test
*/
#[Test]
public function it_runs_handle(): void
{
/** @var Database $database */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,12 @@

use Cycle\Database\Database;
use Cycle\Database\DatabaseInterface;
use PHPUnit\Framework\Attributes\Test;
use WayOfDev\Tests\TestCase;

class RollbackCommandTest extends TestCase
{
/**
* @test
*/
#[Test]
public function it_runs_handle(): void
{
/** @var Database $database */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,12 @@
use Cycle\Database\Database;
use Cycle\Database\DatabaseInterface;
use Illuminate\Support\Facades\Artisan;
use PHPUnit\Framework\Attributes\Test;
use WayOfDev\Tests\TestCase;

class StatusCommandTest extends TestCase
{
/**
* @test
*/
#[Test]
public function it_runs_handle(): void
{
/** @var Database $database */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use Cycle\ORM\SchemaInterface;
use Illuminate\Support\Facades\File;
use PHPUnit\Framework\Attributes\Test;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
use WayOfDev\Cycle\Contracts\CacheManager;
Expand Down Expand Up @@ -34,9 +35,7 @@ protected function setUp(): void
File::delete(__DIR__ . '/../../../../../../app/Entities/Tag.php');
}

/**
* @test
*/
#[Test]
public function it_runs_migrate(): void
{
$this->assertConsoleCommandOutputContainsStrings('cycle:orm:migrate', ['-n' => true], self::USER_MIGRATION);
Expand All @@ -46,9 +45,7 @@ public function it_runs_migrate(): void
]);
}

/**
* @test
*/
#[Test]
public function it_runs_migrate_with_no_changes(): void
{
$this->artisanCall('cycle:orm:migrate', ['-n' => true]);
Expand All @@ -58,9 +55,7 @@ public function it_runs_migrate_with_no_changes(): void
$this->assertConsoleCommandOutputContainsStrings('cycle:orm:migrate', [], 'No database changes');
}

/**
* @test
*/
#[Test]
public function it_creates_migration_when_entity_appeared(): void
{
$this->assertConsoleCommandOutputContainsStrings('cycle:orm:migrate', ['-r' => true], self::USER_MIGRATION);
Expand Down Expand Up @@ -98,11 +93,10 @@ class Tag
}

/**
* @test
*
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
#[Test]
public function it_passes_schema_defaults_to_compiler(): void
{
config()->set('cycle.schema.defaults', [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,12 @@

use Cycle\ORM\Parser\Typecast;
use Cycle\ORM\SchemaInterface;
use PHPUnit\Framework\Attributes\Test;
use WayOfDev\Tests\TestCase;

class RenderCommandTest extends TestCase
{
/**
* @test
*/
#[Test]
public function it_runs_handle(): void
{
$this->assertConsoleCommandOutputContainsStrings('cycle:orm:render', ['--no-color' => true], [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@

use Cycle\ORM\EntityManager;
use Illuminate\Support\Facades\Artisan;
use PHPUnit\Framework\Attributes\Test;
use Throwable;
use WayOfDev\App\Entities\User;
use WayOfDev\Tests\TestCase;

class SyncCommandTest extends TestCase
{
/**
* @test
*
* @throws Throwable
*/
#[Test]
public function it_runs_handle(): void
{
$this->artisanCall('cycle:orm:sync');
Expand All @@ -31,10 +31,9 @@ public function it_runs_handle(): void
}

/**
* @test
*
* @throws Throwable
*/
#[Test]
public function it_runs_handle_in_debug_mode(): void
{
$this->assertConsoleCommandOutputContainsStrings('cycle:orm:sync', ['--verbose' => 3], [
Expand All @@ -50,9 +49,7 @@ public function it_runs_handle_in_debug_mode(): void
$this::assertSame(1, $u->id);
}

/**
* @test
*/
#[Test]
public function it_fails_in_production_without_force(): void
{
// Set the application environment to production
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,13 @@
namespace WayOfDev\Tests\Bridge\Laravel\Console\Commands\ORM;

use Cycle\ORM\SchemaInterface;
use PHPUnit\Framework\Attributes\Test;
use WayOfDev\App\Entities\User;
use WayOfDev\Tests\TestCase;

class UpdateCommandTest extends TestCase
{
/**
* @test
*/
#[Test]
public function it_runs_handle(): void
{
$this->artisanCall('cycle:orm');
Expand Down
10 changes: 4 additions & 6 deletions tests/src/Bridge/Laravel/LoggerFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use Illuminate\Log\LogManager;
use Illuminate\Support\Facades\Event;
use Mockery as m;
use PHPUnit\Framework\Attributes\Test;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
use Psr\Log\NullLogger;
Expand All @@ -31,11 +32,10 @@ protected function tearDown(): void
}

/**
* @test
*
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
#[Test]
public function it_should_return_custom_logger_from_factory(): void
{
$this->app['config']->set('cycle.database.logger.use_telescope', false);
Expand All @@ -58,11 +58,10 @@ public function it_should_return_custom_logger_from_factory(): void
}

/**
* @test
*
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
#[Test]
public function it_should_fire_query_executed_event_when_query_is_logged(): void
{
$this->app['config']->set('cycle.database.logger.use_telescope', true);
Expand All @@ -84,11 +83,10 @@ public function it_should_fire_query_executed_event_when_query_is_logged(): void
}

/**
* @test
*
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
#[Test]
public function it_should_return_null_logger_from_factory(): void
{
config()->set('cycle.database.logger', [
Expand Down
Loading