FOSSology  4.4.0
Open Source License Compliance by Open Source Software
editFolderTest.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 /* every test must use these globals, at least $URL */
23 global $URL;
24 
26 {
27  public $editFolderName;
28  public $mybrowser;
29  public $newname;
30 
31  function setUp()
32  {
33  global $URL;
34 
35  $this->Login();
36  /* create a subfolder under Basic-Testing, which is edited below */
37  $pid = getmypid();
38  $this->editFolderName = "EditMe-$pid";
39  $this->createFolder('Basic-Testing', $this->editFolderName);
40  }
41 
42  function testEditFolder()
43  {
44  global $URL;
45 
46  print "starting EditFoldertest\n";
47  $loggedIn = $this->mybrowser->get($URL);
48  $this->assertTrue($this->myassertText($loggedIn, '/Organize/'),
49  "FAIL! Could not find Organize menu\n");
50  $this->assertTrue($this->myassertText($loggedIn, '/Folders /'));
51  $this->assertTrue($this->myassertText($loggedIn, '/Edit Properties/'));
52  $pid = getmypid();
53  $this->newname = "NewEditName-$pid";
54  $this->editFolder($this->editFolderName, $this->newname,
55  "Folder name changed to $this->newname by testEditFolder");
56  /* check the browse page */
57  $page = $this->mybrowser->get("$URL?mod=browse");
58  $this->assertTrue($this->myassertText($page, "/$this->newname/"),
59  "editFolderTest FAILED! Folder $this->newname not found\n");
60  //print "************ page after check for $this->newname *************\n$page\n";
61  }
62 
63  function tearDown()
64  {
65  global $URL;
66  $page = $this->mybrowser->get("$URL?mod=admin_folder_delete");
67  $this->assertTrue($this->myassertText($page, '/Delete Folder/'));
68  $FolderId = $this->getFolderId($this->newname, $page, 'folder');
69  $this->assertTrue($this->mybrowser->setField('folder', $FolderId));
70  $page = $this->mybrowser->clickSubmit('Delete!');
71  $this->assertTrue($page);
72  $this->assertTrue($this->myassertText($page, "/Deletion of folder $this->newname/"),
73  "EditFoldeTest tearDown FAILED! Deletion of $this->newname not found\n");
74  }
75 }
editFolder($folder, $newName, $description=null)
createFolder($parent, $name, $description=null)
getFolderId($folderName, $page, $selectName)
Login($User=NULL, $Password=NULL)