Skip to content

Commit 15c50b5

Browse files
committed
unit tests
1 parent 858e391 commit 15c50b5

5 files changed

Lines changed: 24 additions & 16 deletions

File tree

config/autoload/local.test.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
use LightTest\Common\TestMode;
6+
7+
if (! TestMode::class::isEnabled()) {
8+
return [];
9+
}
10+
11+
return [
12+
'doctrine' => [
13+
'connection' => [
14+
'orm_default' => [
15+
'params' => [
16+
'url' => 'sqlite3:///:memory:',
17+
],
18+
],
19+
],
20+
],
21+
];

config/config.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
// - `*.global.php`
4141
// - `local.php`
4242
// - `*.local.php`
43-
// - `test.local.php`
43+
// - `local.test.php`
4444
new PhpFileProvider(
4545
realpath(__DIR__) . '/autoload/{{,*.}global,{,*.}local,{,*.}test}.php'
4646
),

src/App/src/Entity/AbstractEntity.php

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
use function ucfirst;
1616

1717
#[ORM\MappedSuperclass]
18-
abstract class AbstractEntity implements ArraySerializableInterface, EntityInterface
18+
abstract class AbstractEntity implements ArraySerializableInterface
1919
{
2020
#[ORM\Id]
2121
#[ORM\Column(name: 'id', type: 'uuid', unique: true, nullable: false)]
@@ -68,18 +68,6 @@ public function getUpdatedFormatted(string $dateFormat = 'Y-m-d H:i:s'): ?string
6868
return null;
6969
}
7070

71-
public function isDeleted(): bool
72-
{
73-
return $this->deleted;
74-
}
75-
76-
public function setDeleted(bool $deleted): static
77-
{
78-
$this->deleted = $deleted;
79-
80-
return $this;
81-
}
82-
8371
#[ORM\PrePersist]
8472
public function created(): void
8573
{

test/Unit/App/Entity/AbstractEntityTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
use DateTimeImmutable;
88
use Light\App\Entity\AbstractEntity;
9-
use Light\App\Entity\EntityInterface;
109
use LightTest\Unit\UnitTest;
1110
use Ramsey\Uuid\Uuid;
1211
use Ramsey\Uuid\UuidInterface;
@@ -50,7 +49,7 @@ public function getUpdatedFormatted(string $dateFormat = 'Y-m-d H:i:s'): ?string
5049
}
5150
};
5251

53-
$this->assertContainsOnlyInstancesOf(EntityInterface::class, [$entity]);
52+
$this->assertContainsOnlyInstancesOf(AbstractEntity::class, [$entity]);
5453
$this->assertContainsOnlyInstancesOf(UuidInterface::class, [$entity->getId()]);
5554
}
5655
}

0 commit comments

Comments
 (0)