FOSSology  3.2.0rc1
Open Source License Compliance by Open Source Software
editFolderDescriptionOnlyTest.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  ***********************************************************/
18 
31 require_once ('../../../tests/fossologyTestCase.php');
32 require_once ('../../../tests/TestEnvironment.php');
33 
34 /* every test must use these globals, at least $URL */
35 global $URL;
36 
38 {
39  public $folder_name;
40  public $mybrowser;
41 
42  function setUp()
43  {
44  global $URL;
45 
46  $this->Login();
47  /* create a folder, which is edited below */
48  $page = $this->mybrowser->get("$URL?mod=folder_create");
49  $this->assertTrue($this->myassertText($page, '/Create a new Fossology folder/'));
50  /* select the folder to create this folder under */
51  $FolderId = $this->getFolderId('Basic-Testing', $page, 'parentid');
52  $this->assertTrue($this->mybrowser->setField('parentid', $FolderId));
53  $pid = getmypid();
54  $this->folder_name = "EditDescription-$pid";
55  $this->assertTrue($this->mybrowser->setField('newname', $this->folder_name));
56  $desc = 'Folder created by EditFolderDesctriptionOnlyTest as subfolder of Testing';
57  $this->assertTrue($this->mybrowser->setField('description', "$desc"));
58  $page = $this->mybrowser->clickSubmit('Create!');
59  $this->assertTrue($page);
60  $this->assertTrue($this->myassertText($page, "/Folder $this->folder_name Created/"),
61  "FAIL! Folder $this->folder_name Created not found\n");
62  }
63 
64  function testEditFolderDescriptionOnly()
65  {
66  global $URL;
67 
68  print "starting EditFolderDescriptoinOnlytest\n";
69  $loggedIn = $this->mybrowser->get($URL);
70  $this->assertTrue($this->myassertText($loggedIn, '/Organize/'),
71  "FAIL! Could not find Organize menu\n");
72  $this->assertTrue($this->myassertText($loggedIn, '/Folders /'));
73  $this->assertTrue($this->myassertText($loggedIn, '/Edit Properties/'));
74  /* ok, this proves the text is on the page, let's see if we can
75  * go to the page and delete a folder
76  */
77  $page = $this->mybrowser->get("$URL?mod=folder_properties");
78  $this->assertTrue($this->myassertText($page, '/Edit Folder Properties/'));
79  $pid = getmypid();
80  $desc = "Folder description changed by EditFolderDescriptionOnlyTest-$pid as subfolder of Testing";
81  $this->assertTrue($this->mybrowser->setField('newdesc', "$desc"),
82  "FAIL! Could not set description 'newdesc'\n");
83  $page = $this->mybrowser->clickSubmit('Edit!');
84  $this->assertTrue($page);
85  $this->assertTrue($this->myassertText($page, "/Folder Properties changed/"),
86  "FAIL! Folder Properties changed not found\n");
87  /* check the browse page */
88  $page = $this->mybrowser->get("$URL?mod=browse");
89  $this->assertTrue($this->myassertText($page, "/$desc/"),
90  "FAIL! Folder $desc not found\n");
91  //print "************ page after Folder Delete! *************\n$page\n";
92  }
93  function tearDown()
94  {
95  global $URL;
96  $page = $this->mybrowser->get("$URL?mod=admin_folder_delete");
97  $this->assertTrue($this->myassertText($page, '/Delete Folder/'));
98  $FolderId = $this->getFolderId($this->folder_name, $page, 'folder');
99  $this->assertTrue($this->mybrowser->setField('folder', $FolderId));
100  $page = $this->mybrowser->clickSubmit('Delete!');
101  $this->assertTrue($page);
102  $this->assertTrue($this->myassertText($page, "/Deletion of folder $this->folder_name/"),
103  "EditFolderDescriptionOnlyTest tearDown FAILED! Deletion of $this->folder_name not found\n");
104  }
105 }
106 
107 ?>
getFolderId($folderName, $page, $selectName)
Login($User=NULL, $Password=NULL)
const char * folder_name
Definition: sqlstatements.h:65