1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-25 19:11:47 +02:00

[ticket/16910] Fix ACP orphan attachments module tests

PHPBB3-16910
This commit is contained in:
rxu
2021-11-22 20:04:20 +07:00
parent 0766facdb2
commit 3f47b490b9

View File

@@ -82,9 +82,12 @@ class phpbb_functional_acp_attachments_test extends phpbb_functional_test_case
// Also the file name should be in the first row of the files table
$this->assertEquals('valid.jpg', $crawler->filter('span.file-name > a')->text());
// Get attach id, the link looks similar to ./download/attachment/3
$attach_link = $crawler->filter('span.file-name > a')->attr('href');
$attach_id = $this->get_parameter_from_link($attach_link, 'id');
$matches = [];
preg_match('/\/([0-9]+)$/', $attach_link, $matches);
$attach_id = (int) $matches[1];
// Set file time older than 3 hours to consider it orphan
$sql = 'UPDATE ' . ATTACHMENTS_TABLE . '