fix: make-global keeps the backup sentence on a failure on page 2+ (ruling P14)
failedOn() replaced the hint for a failure after earlier pages were replaced, so the "Sicherung X liegt im Papierkorb" sentence of the failed page's backup was lost. The hint now leads with it when a backup exists. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01At3V6SjwbMe6eMzVGW3Hs7
This commit is contained in:
@@ -500,6 +500,34 @@ final class LibraryMakeGlobalAbilityTest extends TestCase
|
||||
}
|
||||
}
|
||||
|
||||
/** Re-review: a failure on page 2+ after its backup keeps the backup sentence in hint and message (P14). */
|
||||
public function testAFailureMidwayAfterABackupKeepsTheBackupSentence(): void
|
||||
{
|
||||
$this->givenCopiesOf1058();
|
||||
$jobs = get_post(9);
|
||||
$jobs->post_status = 'publish';
|
||||
LibraryFixtures::given([$this->page, LibraryFixtures::item(1058), get_post(8), $jobs]);
|
||||
Functions\when('wp_revisions_enabled')->justReturn(false);
|
||||
|
||||
try {
|
||||
$this->ability([], true, false, [null, WriteFailed::rolledBack('Grund.')])
|
||||
->execute(self::targets(['s0'], ['s1'], true));
|
||||
self::fail('no WriteFailed');
|
||||
} catch (WriteFailed $e) {
|
||||
$error = $e->toError();
|
||||
self::assertSame(9, $e->details['failed_post']);
|
||||
self::assertSame([8], $e->details['changed_posts']);
|
||||
self::assertSame(1071, $e->details['backup_id']);
|
||||
self::assertStringContainsString(
|
||||
sprintf(VisibleEditsTest::KEPT, 1071, 'der Seite'),
|
||||
$error->get_error_data()['hint']
|
||||
);
|
||||
self::assertStringContainsString('lit/library-find-similar', $error->get_error_data()['hint']);
|
||||
self::assertStringContainsString('Sicherung 1071 im Papierkorb', Errors::clientMessage($error));
|
||||
}
|
||||
self::assertCount(2, $this->backups);
|
||||
}
|
||||
|
||||
/** A failure on page N: the pages before stay replaced (each with revision), the rest untouched – all named. */
|
||||
public function testAFailureMidwayReportsEveryPage(): void
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user