Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
jygaulier committed Sep 25, 2023
1 parent 0263c91 commit 2da6262
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
Empty file modified cache/.gitkeep
100644 → 100755
Empty file.
11 changes: 8 additions & 3 deletions lib/Alchemy/Phrasea/Controller/Prod/ToolsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -316,14 +316,19 @@ public function changeThumbnailAction(Request $request)

$media = $this->app->getMediaFromUri($tempoFile);

$this->getSubDefinitionSubstituer()->substituteSubdef($record, $request->get('subdef'), $media);
// no BC break before PHRAS-3918 when only "thumbnail" was substituable
if(($subdef = $request->get('subdef')) === null) {
$subdef = 'thumbnail';
}

$this->getSubDefinitionSubstituer()->substituteSubdef($record, $subdef, $media);
$this->getDataboxLogger($record->getDatabox())
->log($record, \Session_Logger::EVENT_SUBSTITUTE, $request->get('subdef'), '');
->log($record, \Session_Logger::EVENT_SUBSTITUTE, $subdef, '');

unlink($tempoFile);
rmdir($tempoDir);
$success = true;
$message = sprintf($this->app->trans('Subdef "%s" has been successfully substitued'), $request->get('subdef'));
$message = sprintf($this->app->trans('Subdef "%s" has been successfully substitued'), $subdef);
}
catch (\Exception $e) {
$success = false;
Expand Down
2 changes: 1 addition & 1 deletion tests/Alchemy/Tests/Phrasea/Controller/Prod/ToolsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,6 @@ public function testRouteChangeThumb()
$response = self::$DI['client']->getResponse();
$message = trim($crawler->filterXPath('//div')->text());
$this->assertEquals(200, $response->getStatusCode());
$this->assertEquals(self::$DI['app']['translator']->trans('Thumbnail has been successfully substitued'), $message);
$this->assertEquals(sprintf(self::$DI['app']['translator']->trans('Subdef "%s" has been successfully substitued'), 'thumbnail'), $message);
}
}

0 comments on commit 2da6262

Please sign in to comment.