FOSSology  3.2.0rc1
Open Source License Compliance by Open Source Software
editFolderTest.php
1 <?php
2 /***********************************************************
3  Copyright (C) 2008 Hewlett-Packard Development Company, L.P.
4 
5  This program is free software; you can redistribute it and/or
6  modify it under the terms of the GNU General Public License
7  version 2 as published by the Free Software Foundation.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License along
15  with this program; if not, write to the Free Software Foundation, Inc.,
16  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17  ***********************************************************/
30 require_once ('../../../tests/fossologyTestCase.php');
31 require_once ('../../../tests/TestEnvironment.php');
32 
33 /* every test must use these globals, at least $URL */
34 global $URL;
35 
37 {
38  public $editFolderName;
39  public $mybrowser;
40  public $newname;
41 
42  function setUp()
43  {
44  global $URL;
45 
46  $this->Login();
47  /* create a subfolder under Basic-Testing, which is edited below */
48  $pid = getmypid();
49  $this->editFolderName = "EditMe-$pid";
50  $this->createFolder('Basic-Testing', $this->editFolderName);
51  }
52 
53  function testEditFolder()
54  {
55  global $URL;
56 
57  print "starting EditFoldertest\n";
58  $loggedIn = $this->mybrowser->get($URL);
59  $this->assertTrue($this->myassertText($loggedIn, '/Organize/'),
60  "FAIL! Could not find Organize menu\n");
61  $this->assertTrue($this->myassertText($loggedIn, '/Folders /'));
62  $this->assertTrue($this->myassertText($loggedIn, '/Edit Properties/'));
63  $pid = getmypid();
64  $this->newname = "NewEditName-$pid";
65  $this->editFolder($this->editFolderName, $this->newname,
66  "Folder name changed to $this->newname by testEditFolder");
67  /* check the browse page */
68  $page = $this->mybrowser->get("$URL?mod=browse");
69  $this->assertTrue($this->myassertText($page, "/$this->newname/"),
70  "editFolderTest FAILED! Folder $this->newname not found\n");
71  //print "************ page after check for $this->newname *************\n$page\n";
72  }
73 
74  function tearDown()
75  {
76  global $URL;
77  $page = $this->mybrowser->get("$URL?mod=admin_folder_delete");
78  $this->assertTrue($this->myassertText($page, '/Delete Folder/'));
79  $FolderId = $this->getFolderId($this->newname, $page, 'folder');
80  $this->assertTrue($this->mybrowser->setField('folder', $FolderId));
81  $page = $this->mybrowser->clickSubmit('Delete!');
82  $this->assertTrue($page);
83  $this->assertTrue($this->myassertText($page, "/Deletion of folder $this->newname/"),
84  "EditFoldeTest tearDown FAILED! Deletion of $this->newname not found\n");
85  }
86 }
87 
88 ?>
createFolder($parent=null, $name, $description=null)
editFolder($folder, $newName, $description=null)
getFolderId($folderName, $page, $selectName)
Login($User=NULL, $Password=NULL)