File: mytest.php

package info (click to toggle)
fossology 1.1.0-2
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 10,984 kB
  • ctags: 7,160
  • sloc: ansic: 32,477; php: 22,920; sh: 1,572; perl: 1,352; makefile: 1,110; xml: 201; sql: 21
file content (93 lines) | stat: -rw-r--r-- 3,483 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<?php
/***********************************************************
 Copyright (C) 2008 Hewlett-Packard Development Company, L.P.

 This program is free software; you can redistribute it and/or
 modify it under the terms of the GNU General Public License
 version 2 as published by the Free Software Foundation.

 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.

 You should have received a copy of the GNU General Public License along
 with this program; if not, write to the Free Software Foundation, Inc.,
 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 ***********************************************************/

/**
 * Template to use for a simpletest test
 *
 * @version "$Id: mytest.php 2017 2009-04-25 03:02:01Z rrando $"
 *
 * Created on Aug 1, 2008
 */

/* every test must use these includes, adjust the paths based on where the
 * tests are in the source tree.
 */
require_once ('TestEnvironment.php');
require_once ('fossologyTestCase.php');

global $URL;

class myFirstTest extends fossologyTestCase
{
  public $mybrowser;
  public $testFolder;

  /*
   * Every Test needs to login so we use the setUp method for that.
   * setUp is called before any other method by default.
   *
   * If other actions like creating a folder or something are needed,
   * put them in the setUp method after login.
   *
   */
  function setUp()
  {
    $this->Login();
  }
/* all runnable test names (methods/functions) must start with 'test' */
  function testmytest()
  {
    global $URL;
    print "starting testmytest\n";
    $page = $this->mybrowser->get($URL);
    $page = $this->mybrowser->clickLink('Browse');
    //print "page after Browse is:\n$page\n";
    $this->assertTrue($this->myassertText($page,'/Folder Navigation/'),
                      "testmyTest FAILED! There is no Folder Navigation Title\n");
    $page = $this->mybrowser->clickLink('Create');
    $this->testFolder = 'Sample-Folder';
    $this->createFolder('Testing', $this->testFolder, null);
    /* normally one should verify that the folder was created.  You could
     * see if it was in the Software Repository listing, you could find
     * it's folder_pk in the page and verify that by looking in the
     * db... for this sample, the tear down method will also serve as a
     * verify method.  If teardown fails, because it can't find the
     * folder, then we know that the folder create failed.  Additionally
     * the createFolder routine verifies it saw the folder created
     * message... so for this example, I skipped it.
     */
  }
  /* use the tearDown method to clean up after a test.  This method like
   * setUp will run after every test.
   */

   function tearDown()
   {
    global $URL;
    print "mytest: in tearDown\n";
    $page = $this->mybrowser->get("$URL?mod=admin_folder_delete");
    $this->assertTrue($this->myassertText($page, '/Delete Folder/'));
    $FolderId = $this->getFolderId($this->testFolder, $page);
    $this->assertTrue($this->mybrowser->setField('folder', $FolderId));
    $page = $this->mybrowser->clickSubmit('Delete!');
    $this->assertTrue(page);
    $this->assertTrue($this->myassertText($page, "/Deletion of folder $this->testFolder/"),
                      "FolderTest tearDown FAILED! Deletion of $this->testFolder not found\n");
   }
}
?>