FOSSology  4.4.0
Open Source License Compliance by Open Source Software
cleanRF.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 
18 require_once ('fossologyTestCase.php');
19 require_once ('TestEnvironment.php');
20 
21 global $URL;
22 
24  public $mybrowser;
25 
26  function setUp() {
27  global $URL;
28  $this->Login();
29  }
30 
31  function testRmRFContent() {
32  global $URL;
33  print "Removing the content of the root folder (Software Repository)\n";
34  $page = $this->mybrowser->get($URL);
35  $page = $this->mybrowser->clickLink('Delete Uploaded File');
36  $this->assertTrue($this->myassertText($page, '/Select the uploaded file to delete/'),
37  "Could not select an uploaded file, (did not see the text)\n" .
38  "Make sure you are logged in a fossy\n");
39  $SRselect = $this->parseSelectStmnt($page,'upload');
40  //print "SRselect is:\n"; print_r($SRselect) . "\n";
41  if(empty($SRselect)) {
42  $this->pass('Nothing to remove');
43  return;
44  }
45  foreach($SRselect as $uploadName => $uploadId){
46  print "Removing $uploadName...\n";
47  $this->assertTrue($this->mybrowser->setField('upload', $uploadId));
48  $page = $this->mybrowser->clickSubmit('Delete!');
49  $this->assertTrue($page);
50  $this->assertTrue($this->myassertText($page, "/Deletion added to job queue/"),
51  "delete Upload Failed!\nPhrase 'Deletion added to job queue' not found\n");
52  }
53  }
54 }
parseSelectStmnt($page, $selectName, $optionText=NULL)
Login($User=NULL, $Password=NULL)