aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Fischer <bantu@phpbb.com>2014-02-10 02:16:27 +0100
committerAndreas Fischer <bantu@phpbb.com>2014-02-10 02:16:27 +0100
commit02674de89367895642b57450b5444ab23488ab9b (patch)
tree5124eda45fba235ef34b558a0d555509d419a846
parenteb2d8fe6d889d315ab024e6f1700e25e3399fcd7 (diff)
parent1fdd01275e9fc65a28fb0c95efc3dde0f36ea976 (diff)
downloadforums-02674de89367895642b57450b5444ab23488ab9b.tar
forums-02674de89367895642b57450b5444ab23488ab9b.tar.gz
forums-02674de89367895642b57450b5444ab23488ab9b.tar.bz2
forums-02674de89367895642b57450b5444ab23488ab9b.tar.xz
forums-02674de89367895642b57450b5444ab23488ab9b.zip
Merge pull request #2022 from nickvergessen/ticket/12175
Ticket/12175 Fix and run functional upload tests * nickvergessen/ticket/12175: [ticket/12175] Do not use admin account for file size limit test [ticket/12175] Fix test for uploading a valid file [ticket/12175] Fix upload test for empty file
-rw-r--r--tests/functional/fileupload_form_test.php22
1 files changed, 15 insertions, 7 deletions
diff --git a/tests/functional/fileupload_form_test.php b/tests/functional/fileupload_form_test.php
index ad01d7b2df..c291712c71 100644
--- a/tests/functional/fileupload_form_test.php
+++ b/tests/functional/fileupload_form_test.php
@@ -19,7 +19,6 @@ class phpbb_functional_fileupload_form_test extends phpbb_functional_test_case
parent::setUp();
$this->path = __DIR__ . '/fixtures/files/';
$this->add_lang('posting');
- $this->login();
}
public function tearDown()
@@ -63,30 +62,39 @@ class phpbb_functional_fileupload_form_test extends phpbb_functional_test_case
public function test_empty_file()
{
- $this->markTestIncomplete('Test fails intermittently.');
+ $this->login();
+
$crawler = $this->upload_file('empty.png', 'image/png');
- $this->assertEquals($this->lang('ATTACHED_IMAGE_NOT_IMAGE'), $this->assert_filter($crawler, 'div#message p')->text());
+ $this->assertEquals($this->lang('EMPTY_FILEUPLOAD'), $crawler->filter('p.error')->text());
}
public function test_invalid_extension()
{
+ $this->login();
+
$crawler = $this->upload_file('illegal-extension.bif', 'application/octet-stream');
$this->assertEquals($this->lang('DISALLOWED_EXTENSION', 'bif'), $crawler->filter('p.error')->text());
}
public function test_too_large()
{
- $this->markTestIncomplete('Functional tests use an admin account which ignores maximum upload size.');
+ $this->create_user('fileupload');
+ $this->login('fileupload');
+
$crawler = $this->upload_file('too-large.png', 'image/png');
$this->assertEquals($this->lang('WRONG_FILESIZE', '256', 'KiB'), $crawler->filter('p.error')->text());
}
public function test_valid_file()
{
- $this->markTestIncomplete('Test fails intermittently.');
+ $this->login();
+
$crawler = $this->upload_file('valid.jpg', 'image/jpeg');
- // ensure there was no error message rendered
+
+ // Ensure there was no error message rendered
$this->assertNotContains('<h2>' . $this->lang('INFORMATION') . '</h2>', $this->get_content());
- $this->assertContains($this->lang('POSTED_ATTACHMENTS'), $crawler->filter('#postform h3')->eq(1)->text());
+
+ // Also the file name should be in the first row of the files table
+ $this->assertEquals('valid.jpg', $crawler->filter('span.file-name')->eq(1)->text());
}
}