Clarify test suite taxonomy
This commit is contained in:
@@ -9,6 +9,10 @@ ohne dass jede Aenderung immer die komplette Suite im Kopf behalten muss.
|
||||
## PHPUnit-Suiten
|
||||
|
||||
- `CoreCore`: gesamte Test-Suite.
|
||||
- `Unit`: kleine verhaltensorientierte Unit-Tests ohne breites Orchestrierungs-Setup.
|
||||
- `Service`: Business-Logik, Policies, Gateways und Orchestrierungs-Tests unter `tests/Service/`.
|
||||
- `Repository`: Query- und Repository-Tests unter `tests/Repository/`.
|
||||
- `Domain`: fachliche Taxonomie- und Domain-Tests unter `tests/Domain/`.
|
||||
- `Architecture`: alle Architektur-Contracts unter `tests/Architecture/`.
|
||||
- `ArchitectureCore`: Core-Boundaries, Module-/Repository-Contracts, Taxonomie- und Sync-Contracts.
|
||||
- `ArchitectureSecurity`: CSRF, PRG, File-Storage, Crypto, Logging sowie AuthZ-nahe Contracts.
|
||||
@@ -30,9 +34,24 @@ ohne dass jede Aenderung immer die komplette Suite im Kopf behalten muss.
|
||||
- `refactor`: Schutz ist wichtig, aber der Test ist zu datei-, markup- oder implementation-detailnah.
|
||||
- `delete`: dupliziert bestehende Schutzwirkung oder prueft nur historische Altlasten.
|
||||
|
||||
## Naechste Refactor-Kandidaten
|
||||
## Regeln fuer neue Service-Tests
|
||||
|
||||
- `tests/Architecture/ContainerFactoryContractTest.php`
|
||||
- `tests/Architecture/SecurityCryptoContractTest.php`
|
||||
- `tests/Architecture/AuthzApiBootstrapContractTest.php`
|
||||
- `tests/Architecture/ListUiSharedPartialsContractTest.php`
|
||||
- Services auf Guards, Orchestrierung, Normalisierung, Fehlerpfade und Seiteneffekte testen.
|
||||
- Keine eigenen Tests fuer reine `find/list/get/set`-Delegation ohne zusaetzliche Regel.
|
||||
- Thin Wrapper auf gemeinsame Primitive zentral testen, nicht pro Gateway erneut.
|
||||
- Mockability-, Reflection- und Interface-Existenz-Tests ohne Risiko-Schutz vermeiden.
|
||||
- Kleine Normalisierungs-Matrizen mit DataProvidern oder zusammengezogenen Contract-Dateien verdichten.
|
||||
|
||||
## Typische Low-Value-Muster
|
||||
|
||||
- Gateway-Test prueft nur `encrypt/decrypt` erneut, obwohl das Basisverhalten schon zentral abgesichert ist.
|
||||
- Test bestaetigt nur, dass ein Service eins zu eins an Repository oder Gateway weiterreicht.
|
||||
- Test prueft nur Methodensignatur, Reflection oder dass eine Klasse mockbar ist.
|
||||
- Mehrere Minidateien decken denselben Settings-/Fallback-Mechanismus mit identischem Mock-Muster ab.
|
||||
|
||||
## Naechste Audit-Kandidaten
|
||||
|
||||
- methodenweiser Low-value-Pass in `tests/Service/User/UserAccountServiceTest.php`
|
||||
- methodenweiser Low-value-Pass in `tests/Service/Org/DepartmentServiceTest.php`
|
||||
- methodenweiser Low-value-Pass in `tests/Service/Access/RoleServiceTest.php`
|
||||
- verbleibende kleine Settings-Gateway-Tests auf weitere Verdichtung pruefen
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
namespace MintyPHP\Tests\Unit\Module;
|
||||
|
||||
use MintyPHP\Module\AddressBook\AddressBookAuthorizationPolicy;
|
||||
use MintyPHP\Service\Access\AuthorizationPolicyInterface;
|
||||
use MintyPHP\Service\Access\PermissionService;
|
||||
use MintyPHP\Tests\Service\Access\AuthorizationPolicyTestSupport;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
@@ -15,12 +14,6 @@ final class AddressBookAuthorizationPolicyTest extends TestCase
|
||||
{
|
||||
use AuthorizationPolicyTestSupport;
|
||||
|
||||
public function testImplementsInterface(): void
|
||||
{
|
||||
$policy = new AddressBookAuthorizationPolicy($this->createMock(PermissionService::class));
|
||||
self::assertInstanceOf(AuthorizationPolicyInterface::class, $policy);
|
||||
}
|
||||
|
||||
public function testSupportsOwnAbility(): void
|
||||
{
|
||||
$policy = new AddressBookAuthorizationPolicy($this->createMock(PermissionService::class));
|
||||
|
||||
@@ -3,17 +3,10 @@
|
||||
namespace MintyPHP\Tests\Unit\Module;
|
||||
|
||||
use MintyPHP\Module\Bookmarks\BookmarksAuthorizationPolicy;
|
||||
use MintyPHP\Service\Access\AuthorizationPolicyInterface;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
final class BookmarksAuthorizationPolicyTest extends TestCase
|
||||
{
|
||||
public function testImplementsAuthorizationPolicyContract(): void
|
||||
{
|
||||
$policy = new BookmarksAuthorizationPolicy();
|
||||
self::assertInstanceOf(AuthorizationPolicyInterface::class, $policy);
|
||||
}
|
||||
|
||||
public function testSupportsBookmarksAbilityOnly(): void
|
||||
{
|
||||
$policy = new BookmarksAuthorizationPolicy();
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
namespace MintyPHP\Tests\Unit\Module;
|
||||
|
||||
use MintyPHP\App\AppContainer;
|
||||
use MintyPHP\App\Module\Contracts\SessionProvider;
|
||||
use MintyPHP\Module\AddressBook\Providers\AddressBookSessionProvider;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
@@ -31,12 +30,6 @@ final class SessionProviderTest extends TestCase
|
||||
return new AppContainer();
|
||||
}
|
||||
|
||||
public function testImplementsSessionProviderContract(): void
|
||||
{
|
||||
$provider = new AddressBookSessionProvider();
|
||||
self::assertInstanceOf(SessionProvider::class, $provider);
|
||||
}
|
||||
|
||||
public function testPopulateWithInvalidUserClearsSessionKey(): void
|
||||
{
|
||||
$_SESSION['module.addressbook.departments_by_tenant'] = [['tenant' => 'old']];
|
||||
|
||||
Reference in New Issue
Block a user