refactor(tests): remove redundant tests and fix assertion style
Remove subset/duplicate architecture tests already covered by broader checks, and replace assertTrue(true) with self::addToAssertionCount(1) for explicit no-exception-thrown intent. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -10,28 +10,6 @@ class AuthzUiActionContractTest extends TestCase
|
||||
use AuthzUiContractSupport;
|
||||
use ProjectFileAssertionSupport;
|
||||
|
||||
public function testHardCutActionsProvideViewAuthPageCapabilities(): void
|
||||
{
|
||||
$actions = [
|
||||
'pages/admin/users/index().php',
|
||||
'pages/admin/users/create().php',
|
||||
'pages/admin/tenants/edit($id).php',
|
||||
'pages/admin/departments/edit($id).php',
|
||||
'pages/admin/stats/index().php',
|
||||
'pages/admin/api-audit/index().php',
|
||||
'pages/admin/system-audit/index().php',
|
||||
'pages/admin/import-audit/index().php',
|
||||
'pages/admin/scheduled-jobs/index().php',
|
||||
'pages/admin/user-lifecycle-audit/index().php',
|
||||
'pages/admin/user-lifecycle-audit/view($id).php',
|
||||
];
|
||||
|
||||
foreach ($actions as $action) {
|
||||
$content = $this->readProjectFile($action);
|
||||
$this->assertStringContainsString("\$viewAuth['page']", $content, $action);
|
||||
}
|
||||
}
|
||||
|
||||
#[DataProvider('adminPageAuthWiringProvider')]
|
||||
public function testAdminPageAuthKeysAreWiredFromActions(
|
||||
string $templateFile,
|
||||
|
||||
@@ -21,9 +21,6 @@ class ListTemplateContractTest extends TestCase
|
||||
);
|
||||
$this->assertStringContainsString('initStandardListPage(', $moduleContent, $file);
|
||||
$this->assertStringNotContainsString('gridFiltersFromSchema(', $content, $file);
|
||||
$this->assertStringNotContainsString('data-toolbar-toggle', $content, $file);
|
||||
$this->assertStringNotContainsString('data-filter-overflow', $content, $file);
|
||||
$this->assertStringNotContainsString('data-filter-toggle', $content, $file);
|
||||
$this->assertSame(0, preg_match('/<select id=\"[^\"]*-filter\"/', $content), $file);
|
||||
$this->assertSame(0, preg_match('/<input[^>]*id=\"[^\"]*-filter\"/', $content), $file);
|
||||
$this->assertSame(0, preg_match('/filters:\s*\[/', $content), $file);
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace MintyPHP\Tests\Architecture;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
final class ListTitlebarMarkupContractTest extends TestCase
|
||||
{
|
||||
use ProjectFileAssertionSupport;
|
||||
|
||||
public function testTemplatesDoNotInlineLegacyListTitlebarMarkup(): void
|
||||
{
|
||||
foreach (ListTitlebarContractFiles::titlebarTemplateFiles() as $file) {
|
||||
$content = $this->readProjectFile($file);
|
||||
$this->assertSame(0, preg_match('/<div\s+class=\"app-list-titlebar\"/', $content), $file);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -120,6 +120,6 @@ class ErrorLoggerTest extends TestCase
|
||||
$exception = new \RuntimeException('safe test');
|
||||
ErrorLogger::log($exception, []);
|
||||
|
||||
$this->assertTrue(true); // If we get here, no exception was thrown.
|
||||
self::addToAssertionCount(1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -161,4 +161,42 @@ class RepositoryArrayHelperTest extends TestCase
|
||||
$this->assertSame([5], $result);
|
||||
$this->assertSame(0, array_key_first($result));
|
||||
}
|
||||
|
||||
// --- flattenRow ---
|
||||
|
||||
public function testFlattenRowMergesNestedTableArrays(): void
|
||||
{
|
||||
$row = [
|
||||
'api_audit_log' => ['id' => 1, 'request_id' => 'abc'],
|
||||
'users' => ['display_name' => 'Alice'],
|
||||
'tenants' => ['description' => 'Tenant A'],
|
||||
];
|
||||
|
||||
$this->assertSame(
|
||||
[
|
||||
'id' => 1,
|
||||
'request_id' => 'abc',
|
||||
'display_name' => 'Alice',
|
||||
'description' => 'Tenant A',
|
||||
],
|
||||
RepositoryArrayHelper::flattenRow($row)
|
||||
);
|
||||
}
|
||||
|
||||
public function testFlattenRowKeepsTopLevelScalarValues(): void
|
||||
{
|
||||
$row = [
|
||||
'status' => 'ok',
|
||||
'count' => 3,
|
||||
];
|
||||
|
||||
$this->assertSame(['status' => 'ok', 'count' => 3], RepositoryArrayHelper::flattenRow($row));
|
||||
}
|
||||
|
||||
public function testFlattenRowReturnsEmptyForNonArray(): void
|
||||
{
|
||||
$this->assertSame([], RepositoryArrayHelper::flattenRow(null));
|
||||
$this->assertSame([], RepositoryArrayHelper::flattenRow(false));
|
||||
$this->assertSame([], RepositoryArrayHelper::flattenRow('text'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -305,7 +305,7 @@ class RateLimiterServiceTest extends TestCase
|
||||
|
||||
// Should not throw — exceptions are silently ignored.
|
||||
$this->service->reset('login', 'user@example.com');
|
||||
$this->assertTrue(true);
|
||||
self::addToAssertionCount(1);
|
||||
}
|
||||
|
||||
public function testResetWithEmptyScopeDoesNothing(): void
|
||||
|
||||
Reference in New Issue
Block a user