FOSSology  4.4.0
Open Source License Compliance by Open Source Software
uploadWoutEmail.php
1 <?php
2 /*
3  SPDX-FileCopyrightText: © 2008 Hewlett-Packard Development Company, L.P.
4 
5  SPDX-License-Identifier: GPL-2.0-only
6 */
19 require_once ('../../../tests/fossologyTestCase.php');
20 require_once ('../../../tests/TestEnvironment.php');
21 
22 global $URL;
23 
25 
26  public $mybrowser;
27 
28  public function setUp() {
29  global $URL;
30  $last = exec('./changeENV.php -s fosstester -c noemail', $out, $rtn);
31  if($rtn > 0) {
32  $this->fail("Could not change the test environment file, stopping test\n");
33  print "Failure, output from changeENV is:\n";print_r($out) . "\n";
34  exit(1);
35  }
36  $this->Login();
37  //$this->Login();
38  $result = $this->createFolder(1, 'Enote', 'Folder for Email notification uploads');
39  if(!is_null($result)) {
40  if($result != 'Folder Enote Exists') {
41  $this->fail("Failure! folder Enote does not exist, stopping test\n");
42  exit(1);
43  }
44  }
45  }
46 
47  public function testUploadWoutEmail() {
48 
49  global $URL;
50 
51  /* login noemail */
52  print "Starting upload without email notificiation\n";
53  $page = $this->mybrowser->get($URL);
54 
55  $File = '/home/fosstester/licenses/gplv2.1';
56  $Filedescription = "The GPL Version 2.1 from the gnu.org site";
57 
58  $Url = 'http://www.gnu.org/licenses/gpl.txt';
59  $Urldescription = "The GPL Version 3.0 June 2007 from www.gnu.org/licenses/gpl.txt";
60 
61  $Srv = '/home/fosstester/licenses/zlibLicense-1.2.2-2004-Oct-03';
62  $Srvdescription = "zlib license from http://www.gzip.org/zlib/zlib_license.html";
63 
64  $this->uploadFile('Enote', $File, $Filedescription, null, '1');
65  $this->uploadUrl('Enote', $Url, $Urldescription, null, '2');
66  $this->uploadServer('Enote', $Srv, $Srvdescription, null, 'all');
67 
68  /*
69  * need to check email when they finish....
70  */
71  print "waiting for jobs to finish\n";
72  $this->wait4jobs();
73  print "verifying NO email was received\n";
74  $this->checkEmailNotification(0);
75  }
76 
77  public function tearDown() {
78  print "Changing user back to fosstester";
79  $last = exec('./changeENV.php -s noemail -c fosstester', $out, $rtn);
80  if($rtn > 0) {
81  $this->fail("Could not change the test environment file, stopping test\n");
82  print "Failure, output from changeENV is:\n";print_r($out) . "\n";
83  exit(1);
84  }
85  }
86 };
uploadServer($parentFolder, $uploadPath, $description=null, $uploadName=null, $agents=null)
uploadUrl($parentFolder, $url, $description=null, $uploadName=null, $agents=null)
uploadFile($parentFolder, $uploadFile, $description=null, $uploadName=null, $agents=null)
createFolder($parent, $name, $description=null)
Login($User=NULL, $Password=NULL)