FOSSology  4.4.0
Open Source License Compliance by Open Source Software
UploadUrlTest.php
1 <?php
2 /*
3  SPDX-FileCopyrightText: © 2008 Hewlett-Packard Development Company, L.P.
4 
5  SPDX-License-Identifier: GPL-2.0-only
6 */
17 /*
18  * Yuk! This test is ugly! NOTE: Will need to set a proxy for this to
19  * work inside hp.
20  */
21 
22 require_once ('../../../tests/fossologyTestCase.php');
23 require_once ('../../../tests/TestEnvironment.php');
24 
25 global $URL;
26 
28 {
29 
30  function testUploadUrl()
31  {
32  global $URL;
33 
34  print "starting UploadUrlTest\n";
35  //$this->useProxy('http://web-proxy.fc.hp.com:8088', 'web-proxy', '');
36  $this->Login();
37 
38  $loggedIn = $this->mybrowser->get($URL);
39  $this->assertTrue($this->myassertText($loggedIn, '/Upload/'));
40  $this->assertTrue($this->myassertText($loggedIn, '/From URL/'));
41  $page = $this->mybrowser->get("$URL?mod=upload_url");
42  $this->assertTrue($this->myassertText($page, '/Upload from URL/'));
43  $this->assertTrue($this->myassertText($page, '/Enter the URL to the file/'));
44 
45  /* select Testing folder, filename based on pid or session number */
46 
47  $FolderId = $this->getFolderId('Basic-Testing', $page, 'folder');
48  $this->assertTrue($this->mybrowser->setField('folder', $FolderId));
49  $simpletest = 'http://downloads.sourceforge.net/simpletest/simpletest_1.0.1.tar.gz';
50  $this->assertTrue($this->mybrowser->setField('geturl', $simpletest));
51  $desc = 'File uploaded by test UploadUrlTest';
52  $this->assertTrue($this->mybrowser->setField('description', "$desc"));
53  $pid = getmypid();
54  $upload_name = 'TestUploadUrl-' . "$pid";
55  $this->assertTrue($this->mybrowser->setField('name', $upload_name));
56  /* we won't select any agents this time' */
57  $page = $this->mybrowser->clickSubmit('Upload!');
58  $this->assertTrue($page);
59  //print "************ page after Upload! *************\n$page\n";
60  $this->assertTrue($this->myassertText($page, '/has been scheduled. It is/'));
61 
62 
63  }
64 }
getFolderId($folderName, $page, $selectName)
Login($User=NULL, $Password=NULL)