FOSSology  4.4.0
Open Source License Compliance by Open Source Software
moveUploadTest.php
1 <?php
2 /*
3  SPDX-FileCopyrightText: © 2008 Hewlett-Packard Development Company, L.P.
4 
5  SPDX-License-Identifier: GPL-2.0-only
6 */
17 require_once ('../../../tests/fossologyTestCase.php');
18 require_once ('../../../tests/TestEnvironment.php');
19 
20 global $URL;
32 {
33  public $upload2Move;
34  public $fromFolder='root';
35  public $toFolder;
36  public $mybrowser;
37 
38  function setUp()
39  {
40  //print "starting setUp moveUploadTest\n";
41  $this->Login();
42  }
50  function testMoveUpload()
51  {
52  global $URL;
53 
54  print "starting MoveUploadtest\n";
55  $loggedIn = $this->mybrowser->get($URL);
56  $this->assertTrue($this->myassertText($loggedIn, '/Organize/'),
57  "FAIL! Could not find Organize menu\n");
58  $this->assertTrue($this->myassertText($loggedIn, '/Uploads /'),
59  "testMoveUpload FAILED! coun not find Uploads menu\n");
60  /* this assertion below is bogus, there are multiple Move (s) */
61  $this->assertTrue($this->myassertText($loggedIn, '/Move/'));
62  $this->upload2Move = 'gpl-3.0.txt';
63  $this->toFolder = 'Basic-Testing';
64  /* fromFolder is 'root' */
65  $this->moveUpload($this->fromFolder, $this->toFolder, $this->upload2Move);
66  /* best we can do with simpletest is to see if the folder is still there.
67  *
68  */
69  $page = $this->mybrowser->clickLink('Browse');
70  $page = $this->mybrowser->clickLink('Basic-Testing');
71  $this->assertTrue($this->myassertText($page, "/$this->upload2Move/"),
72  "moveUploadTest FAILED! Folder $this->upload2Move does not exist under Basic-Testing folder\n");
73  //print "************ page after Move! *************\n$page\n";
74  }
75 
76  /*
77  * move the upload back to root folder so the test can be run
78  * multiple times.
79  */
80  function tearDown()
81  {
82  $this->moveUpload('Basic-Testing', 'root', $this->upload2Move);
83  }
84 }
moveUpload($oldFolder, $destFolder, $upload)
Login($User=NULL, $Password=NULL)