mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-10 13:28:55 +00:00
[ticket/17137] Update tests for master branch
PHPBB3-17137
This commit is contained in:
parent
f9fca89ab6
commit
d1941ab769
1 changed files with 18 additions and 15 deletions
|
@ -115,7 +115,8 @@ class phpbb_functional_ucp_attachments_test extends phpbb_functional_test_case
|
||||||
$this->assertEquals('valid.jpg', $crawler->filter('span.file-name > a')->text());
|
$this->assertEquals('valid.jpg', $crawler->filter('span.file-name > a')->text());
|
||||||
|
|
||||||
$attach_link = $crawler->filter('span.file-name > a')->attr('href');
|
$attach_link = $crawler->filter('span.file-name > a')->attr('href');
|
||||||
$attach_id = $this->get_parameter_from_link($attach_link, 'id');
|
preg_match('#download/attachment/([0-9]+)/valid.jpg#', $attach_link, $match);
|
||||||
|
$attach_id = $match[1];
|
||||||
|
|
||||||
// Submit post
|
// Submit post
|
||||||
$form = $crawler->selectButton($this->lang('SUBMIT'))->form([
|
$form = $crawler->selectButton($this->lang('SUBMIT'))->form([
|
||||||
|
@ -132,7 +133,7 @@ class phpbb_functional_ucp_attachments_test extends phpbb_functional_test_case
|
||||||
|
|
||||||
$attachment_filename = $crawler->filter('.attachment-filename');
|
$attachment_filename = $crawler->filter('.attachment-filename');
|
||||||
$this->assertEquals('valid.jpg', $attachment_filename->attr('title'));
|
$this->assertEquals('valid.jpg', $attachment_filename->attr('title'));
|
||||||
$this->assertStringContainsString('download/file.php?id=' . $attach_id, $attachment_filename->attr('href'));
|
$this->assertStringContainsString('app.php/download/attachment/' . $attach_id . '/valid.jpg', $attachment_filename->attr('href'));
|
||||||
$this->assertEquals('', $crawler->filter('[name="attachment[' . $attach_id . ']"]')->attr('disabled'));
|
$this->assertEquals('', $crawler->filter('[name="attachment[' . $attach_id . ']"]')->attr('disabled'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -152,7 +153,8 @@ class phpbb_functional_ucp_attachments_test extends phpbb_functional_test_case
|
||||||
$this->assertEquals('valid.jpg', $crawler->filter('span.file-name > a')->text());
|
$this->assertEquals('valid.jpg', $crawler->filter('span.file-name > a')->text());
|
||||||
|
|
||||||
$attach_link = $crawler->filter('span.file-name > a')->attr('href');
|
$attach_link = $crawler->filter('span.file-name > a')->attr('href');
|
||||||
$attach_id = $this->get_parameter_from_link($attach_link, 'id');
|
preg_match('#download/attachment/([0-9]+)/valid.jpg#', $attach_link, $match);
|
||||||
|
$attach_id = $match[1];
|
||||||
|
|
||||||
// Submit post
|
// Submit post
|
||||||
$form = $crawler->selectButton($this->lang('SUBMIT'))->form([
|
$form = $crawler->selectButton($this->lang('SUBMIT'))->form([
|
||||||
|
@ -170,7 +172,7 @@ class phpbb_functional_ucp_attachments_test extends phpbb_functional_test_case
|
||||||
$crawler = self::request('GET', 'ucp.php?i=ucp_attachments&mode=attachments&sid=' . $this->sid);
|
$crawler = self::request('GET', 'ucp.php?i=ucp_attachments&mode=attachments&sid=' . $this->sid);
|
||||||
$crawler->filter('.attachment-filename')->each(function ($node, $i) use ($attach_id, &$attachment_node)
|
$crawler->filter('.attachment-filename')->each(function ($node, $i) use ($attach_id, &$attachment_node)
|
||||||
{
|
{
|
||||||
if (strpos($node->attr('href'), 'file.php?id=' . $attach_id) !== false)
|
if (strpos($node->attr('href'), 'download/attachment/' . $attach_id . '/valid.jpg') !== false)
|
||||||
{
|
{
|
||||||
$attachment_node = $node;
|
$attachment_node = $node;
|
||||||
}
|
}
|
||||||
|
@ -178,7 +180,7 @@ class phpbb_functional_ucp_attachments_test extends phpbb_functional_test_case
|
||||||
$this->assertNotNull($attachment_node);
|
$this->assertNotNull($attachment_node);
|
||||||
|
|
||||||
$this->assertEquals('valid.jpg', $attachment_node->attr('title'));
|
$this->assertEquals('valid.jpg', $attachment_node->attr('title'));
|
||||||
$this->assertStringContainsString('download/file.php?id=' . $attach_id, $attachment_node->attr('href'));
|
$this->assertStringContainsString('download/attachment/' . $attach_id . '/valid.jpg', $attachment_node->attr('href'));
|
||||||
|
|
||||||
$this->logout();
|
$this->logout();
|
||||||
|
|
||||||
|
@ -209,14 +211,14 @@ class phpbb_functional_ucp_attachments_test extends phpbb_functional_test_case
|
||||||
$crawler = self::request('GET', 'ucp.php?i=ucp_attachments&mode=attachments&sid=' . $this->sid);
|
$crawler = self::request('GET', 'ucp.php?i=ucp_attachments&mode=attachments&sid=' . $this->sid);
|
||||||
$crawler->filter('.attachment-filename')->each(function ($node, $i) use ($attach_id, &$attachment_node)
|
$crawler->filter('.attachment-filename')->each(function ($node, $i) use ($attach_id, &$attachment_node)
|
||||||
{
|
{
|
||||||
if (strpos($node->attr('href'), 'file.php?id=' . $attach_id) !== false)
|
if (strpos($node->attr('href'), 'download/attachment/' . $attach_id . '/valid.jpg') !== false)
|
||||||
{
|
{
|
||||||
$attachment_node = $node;
|
$attachment_node = $node;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$this->assertEquals('valid.jpg', $attachment_node->attr('title'));
|
$this->assertEquals('valid.jpg', $attachment_node->attr('title'));
|
||||||
$this->assertStringContainsString('download/file.php?id=' . $attach_id, $attachment_node->attr('href'));
|
$this->assertStringContainsString('download/attachment/' . $attach_id . '/valid.jpg', $attachment_node->attr('href'));
|
||||||
$this->assertEquals('disabled', $crawler->filter('[name="attachment[' . $attach_id . ']"]')->attr('disabled'));
|
$this->assertEquals('disabled', $crawler->filter('[name="attachment[' . $attach_id . ']"]')->attr('disabled'));
|
||||||
|
|
||||||
// It should not be possible to delete the attachment
|
// It should not be possible to delete the attachment
|
||||||
|
@ -229,13 +231,13 @@ class phpbb_functional_ucp_attachments_test extends phpbb_functional_test_case
|
||||||
|
|
||||||
$crawler->filter('.attachment-filename')->each(function ($node, $i) use ($attach_id, &$attachment_node)
|
$crawler->filter('.attachment-filename')->each(function ($node, $i) use ($attach_id, &$attachment_node)
|
||||||
{
|
{
|
||||||
if (strpos($node->attr('href'), 'file.php?id=' . $attach_id) !== false)
|
if (strpos($node->attr('href'), 'download/attachment/' . $attach_id . '/valid.jpg') !== false)
|
||||||
{
|
{
|
||||||
$attachment_node = $node;
|
$attachment_node = $node;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$this->assertEquals('valid.jpg', $attachment_node->attr('title'));
|
$this->assertEquals('valid.jpg', $attachment_node->attr('title'));
|
||||||
$this->assertStringContainsString('download/file.php?id=' . $attach_id, $attachment_node->attr('href'));
|
$this->assertStringContainsString('download/attachment/' . $attach_id . '/valid.jpg', $attachment_node->attr('href'));
|
||||||
$this->assertEquals('disabled', $crawler->filter('[name="attachment[' . $attach_id . ']"]')->attr('disabled'));
|
$this->assertEquals('disabled', $crawler->filter('[name="attachment[' . $attach_id . ']"]')->attr('disabled'));
|
||||||
|
|
||||||
$this->logout();
|
$this->logout();
|
||||||
|
@ -292,7 +294,8 @@ class phpbb_functional_ucp_attachments_test extends phpbb_functional_test_case
|
||||||
$crawler = $this->upload_file_pm('valid.jpg', 'image/jpeg');
|
$crawler = $this->upload_file_pm('valid.jpg', 'image/jpeg');
|
||||||
|
|
||||||
$attach_link = $crawler->filter('span.file-name > a')->attr('href');
|
$attach_link = $crawler->filter('span.file-name > a')->attr('href');
|
||||||
$attach_id = $this->get_parameter_from_link($attach_link, 'id');
|
preg_match('#download/attachment/([0-9]+)/valid.jpg#', $attach_link, $match);
|
||||||
|
$attach_id = $match[1];
|
||||||
|
|
||||||
$form = $crawler->selectButton($this->lang('ADD'))->form([
|
$form = $crawler->selectButton($this->lang('ADD'))->form([
|
||||||
'username_list' => 'admin'
|
'username_list' => 'admin'
|
||||||
|
@ -306,7 +309,7 @@ class phpbb_functional_ucp_attachments_test extends phpbb_functional_test_case
|
||||||
$crawler = self::submit($form);
|
$crawler = self::submit($form);
|
||||||
|
|
||||||
$this->assertContainsLang('MESSAGE_STORED', $crawler->text());
|
$this->assertContainsLang('MESSAGE_STORED', $crawler->text());
|
||||||
$refresh_data = explode(';', $crawler->filterXpath("//meta[@http-equiv='refresh']")->extract('content')[0]);
|
$refresh_data = explode(';', $crawler->filterXpath("//meta[@http-equiv='refresh']")->attr('content'));
|
||||||
$pm_url = trim($refresh_data[1]);
|
$pm_url = trim($refresh_data[1]);
|
||||||
|
|
||||||
$pm_id = $this->get_parameter_from_link($pm_url, 'p');
|
$pm_id = $this->get_parameter_from_link($pm_url, 'p');
|
||||||
|
@ -315,7 +318,7 @@ class phpbb_functional_ucp_attachments_test extends phpbb_functional_test_case
|
||||||
$crawler = self::request('GET', 'ucp.php?i=ucp_attachments&mode=attachments&sid=' . $this->sid);
|
$crawler = self::request('GET', 'ucp.php?i=ucp_attachments&mode=attachments&sid=' . $this->sid);
|
||||||
$crawler->filter('.attachment-filename')->each(function ($node, $i) use ($attach_id, &$attachment_node)
|
$crawler->filter('.attachment-filename')->each(function ($node, $i) use ($attach_id, &$attachment_node)
|
||||||
{
|
{
|
||||||
if (strpos($node->attr('href'), 'file.php?id=' . $attach_id) !== false)
|
if (strpos($node->attr('href'), 'download/attachment/' . $attach_id . '/valid.jpg') !== false)
|
||||||
{
|
{
|
||||||
$attachment_node = $node;
|
$attachment_node = $node;
|
||||||
}
|
}
|
||||||
|
@ -323,7 +326,7 @@ class phpbb_functional_ucp_attachments_test extends phpbb_functional_test_case
|
||||||
$this->assertNotNull($attachment_node);
|
$this->assertNotNull($attachment_node);
|
||||||
|
|
||||||
$this->assertEquals('valid.jpg', $attachment_node->attr('title'));
|
$this->assertEquals('valid.jpg', $attachment_node->attr('title'));
|
||||||
$this->assertStringContainsString('download/file.php?id=' . $attach_id, $attachment_node->attr('href'));
|
$this->assertStringContainsString('download/attachment/' . $attach_id . '/valid.jpg', $attachment_node->attr('href'));
|
||||||
$this->assertEquals('', $crawler->filter('[name="attachment[' . $attach_id . ']"]')->attr('disabled'));
|
$this->assertEquals('', $crawler->filter('[name="attachment[' . $attach_id . ']"]')->attr('disabled'));
|
||||||
|
|
||||||
// Update message time to 60 minutes later
|
// Update message time to 60 minutes later
|
||||||
|
@ -335,7 +338,7 @@ class phpbb_functional_ucp_attachments_test extends phpbb_functional_test_case
|
||||||
$crawler = self::request('GET', 'ucp.php?i=ucp_attachments&mode=attachments&sid=' . $this->sid);
|
$crawler = self::request('GET', 'ucp.php?i=ucp_attachments&mode=attachments&sid=' . $this->sid);
|
||||||
$crawler->filter('.attachment-filename')->each(function ($node, $i) use ($attach_id, &$attachment_node)
|
$crawler->filter('.attachment-filename')->each(function ($node, $i) use ($attach_id, &$attachment_node)
|
||||||
{
|
{
|
||||||
if (strpos($node->attr('href'), 'file.php?id=' . $attach_id) !== false)
|
if (strpos($node->attr('href'), 'download/attachment/' . $attach_id . '/valid.jpg') !== false)
|
||||||
{
|
{
|
||||||
$attachment_node = $node;
|
$attachment_node = $node;
|
||||||
}
|
}
|
||||||
|
@ -343,7 +346,7 @@ class phpbb_functional_ucp_attachments_test extends phpbb_functional_test_case
|
||||||
$this->assertNotNull($attachment_node);
|
$this->assertNotNull($attachment_node);
|
||||||
|
|
||||||
$this->assertEquals('valid.jpg', $attachment_node->attr('title'));
|
$this->assertEquals('valid.jpg', $attachment_node->attr('title'));
|
||||||
$this->assertStringContainsString('download/file.php?id=' . $attach_id, $attachment_node->attr('href'));
|
$this->assertStringContainsString('download/attachment/' . $attach_id . '/valid.jpg', $attachment_node->attr('href'));
|
||||||
$this->assertEquals('disabled', $crawler->filter('[name="attachment[' . $attach_id . ']"]')->attr('disabled'));
|
$this->assertEquals('disabled', $crawler->filter('[name="attachment[' . $attach_id . ']"]')->attr('disabled'));
|
||||||
|
|
||||||
$this->set_flood_interval(15);
|
$this->set_flood_interval(15);
|
||||||
|
|
Loading…
Add table
Reference in a new issue