X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=web%2Fmodules%2Fcontrib%2Ffilefield_sources%2Fsrc%2FTests%2FUploadSourceTest.php;fp=web%2Fmodules%2Fcontrib%2Ffilefield_sources%2Fsrc%2FTests%2FUploadSourceTest.php;h=01afc53be70daddee323e38994af9745bcae06b2;hp=0000000000000000000000000000000000000000;hb=8acec36f19c470dfcda1ae2336826a782f41874c;hpb=e0411c4e83ba0d079034db83c3f7f55be24a0e35 diff --git a/web/modules/contrib/filefield_sources/src/Tests/UploadSourceTest.php b/web/modules/contrib/filefield_sources/src/Tests/UploadSourceTest.php new file mode 100644 index 000000000..01afc53be --- /dev/null +++ b/web/modules/contrib/filefield_sources/src/Tests/UploadSourceTest.php @@ -0,0 +1,62 @@ +enableSources(array( + 'upload' => TRUE, + )); + + $this->assertUploadSourceWorkProperly(); + } + + /** + * Tests all sources enabled. + */ + public function testAllSourcesEnabled() { + $this->enableSources(array( + 'upload' => TRUE, + 'remote' => TRUE, + 'clipboard' => TRUE, + 'reference' => TRUE, + 'attach' => TRUE, + )); + + $this->assertUploadSourceWorkProperly(); + } + + /** + * Tests upload source still working properly. + */ + protected function assertUploadSourceWorkProperly() { + $file = $this->createTemporaryFileEntity(); + + // Upload a file by 'Upload' source. + $this->uploadFileByUploadSource($file->getFileUri(), $file->getFilename(), 0, FALSE); + + // We can only upload one file on single value field. + $this->assertNoFieldByXPath('//input[@type="submit"]', t('Upload'), t('After uploading a file, "Upload" button is no longer displayed.')); + + // Remove uploaded file. + $this->removeFile($file->getFilename(), 0); + + // Can upload file again. + $this->assertFieldByXpath('//input[@type="submit"]', t('Upload'), 'After clicking the "Remove" button, the "Upload" button is displayed.'); + } + +}