Skip to content

Commit

Permalink
#15 Fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jonasraoni committed Mar 13, 2022
1 parent 445208e commit c1f7269
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
13 changes: 8 additions & 5 deletions CustomLocalePlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,9 @@ public function upgradeLocaleFiles(): void
}

$success = false;
$lockFile = new SplFileObject($lockFilePath, 'x');
$lockFile = null;
try {
$lockFile = new SplFileObject($lockFilePath, 'x');
if (!$lockFile->flock(LOCK_EX)) {
throw new Exception('Failed to lock file');
}
Expand Down Expand Up @@ -294,10 +295,12 @@ public function upgradeLocaleFiles(): void
} catch (Exception $e) {
error_log("An exception happened while upgrading the customLocale plugin.\n" . $e);
} finally {
$lockFile->flock(LOCK_UN);
$lockFile = null;
if (!$success) {
unlink($lockFilePath);
if ($lockFile) {
$lockFile->flock(LOCK_UN);
$lockFile = null;
if (!$success) {
unlink($lockFilePath);
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion cypress/tests/functional/CustomLocale.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ describe('Custom Locale plugin tests', function() {

// FIXME: The new settings tab handler doesn't jump right to the correct tab.
cy.get('button#customLocale-button').click();
cy.get('span.label:contains("lib/pkp/locale/en_US/user.po")').parent().parent().parent().contains('Edit').click();
cy.get('span.label:contains("en_US")').parent().parent().parent().contains('Edit').click();
cy.wait(1000); // Form init
cy.get('input.pkpSearch__input').type('user.affiliation');
cy.get('button.pkpButton:contains("Search")').click();
Expand Down

0 comments on commit c1f7269

Please sign in to comment.