FOSSology  4.4.0
Open Source License Compliance by Open Source Software
UploadSrvArchiveTest.php
1 <?php
2 /*
3  SPDX-FileCopyrightText: © 2008 Hewlett-Packard Development Company, L.P.
4 
5  SPDX-License-Identifier: GPL-2.0-only
6 */
7 
19 /*
20  * NOTE this test is difficult in that the material uploaded MUST be
21  * available to the test. If multiple agent systems are used, then the
22  * material must be available there as well.
23  *
24  * One possibility is to modify the readme to include the creation of
25  * a test user and material. Since it takes sudo, the test cannot
26  * automatically do it. Well it could, but it's a bad idea.
27  */
28 
29 require_once ('../../../tests/fossologyTestCase.php');
30 require_once ('../../../tests/TestEnvironment.php');
31 
32 global $URL;
33 
35  function setUp() {
36  /* check to see if the user and material exist*/
37  $this->assertTrue(file_exists('/home/fosstester/.bashrc'),
38  "FAILURE! .bashrc not found\n");
39  $this->Login();
40  }
41 
42  function testUploadUSrv() {
43 
44  global $URL;
45 
46  print "starting UploadUSrvTest\n";
47  $loggedIn = $this->mybrowser->get($URL);
48  $this->assertTrue($this->myassertText($loggedIn, '/Upload/'),
49  'Did not find Upload Menu');
50  $this->assertTrue($this->myassertText($loggedIn, '/From Server/'),
51  'Did not find From Server Menu');
52  $page = $this->mybrowser->get("$URL?mod=upload_srv_files");
53  $this->assertTrue($this->myassertText($page, '/Upload from Server/'),
54  'Did not find Upload from Server Title');
55  $this->assertTrue($this->myassertText($page, '/on the server to upload:/'),
56  'Did not find the sourcefile Selection Text');
57  /* select Testing folder */
58  $FolderId = $this->getFolderId('Basic-Testing', $page, 'folder');
59  $this->assertTrue($this->mybrowser->setField('folder', $FolderId));
60  $this->assertTrue($this->mybrowser->setField('sourcefiles', '/home/fosstester/archives/simpletest_1.0.1.tar.gz'));
61  $desc = 'File uploaded by test UploadSrvTest to folder Testing';
62  $this->assertTrue($this->mybrowser->setField('description', "$desc"));
63  /* we won't select any agents this time' */
64  $page = $this->mybrowser->clickSubmit('Upload!');
65  $this->assertTrue($page);
66  $this->assertTrue($this->myassertText($page,
67  '/The upload for \/home\/fosstester\/archives\/simpletest_1\.0\.1\.tar\.gz/'),
68  "FAIL! Did not match Upload message\n");
69  //print "************ page after Upload! *************\n$page\n";
70  }
71 }
getFolderId($folderName, $page, $selectName)
Login($User=NULL, $Password=NULL)