FOSSology  3.2.0rc1
Open Source License Compliance by Open Source Software
parameters.php
1 <?php
2 /***********************************************************
3  Copyright (C) 2007 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  ***********************************************************/
27 class TestCLInputCP2foss extends UnitTestCase
28 {
29 
30  public $command = '/usr/local/bin/test.cp2foss';
31 
32  function Testhnpa()
33  {
34 
35  $help = exec("$this->command -h", $output, $retval);
36  //print_r($output);
37  $this->assertPattern('/Usage: cp2foss/', $output[0]);
38  $output = array();
39  $error = exec("$this->command -n foo -a /bar/baz -d 'a comment'", $output, $retval);
40  //print_r($output);
41  $this->assertPattern('/ERROR, -p /', $output[0]);
42  $output = array();
43  $error = exec("$this->command -p foo -a /bar/baz -d \"a comment\"", $output, $retval);
44  //print_r($output);
45  $this->assertPattern('/ERROR, -n /', $output[0]);
46  $output = array();
47  $error = exec("$this->command -p baz -n foo -d 'a comment'", $output, $retval);
48  //print_r($output);
49  $this->assertPattern('/ERROR, -a /', $output[0]);
50  }
51 
52  function TestMissingDashP()
53  {
54 
55  // Note you must have a valid archive
56  $error = exec("$this->command -n foo -a /tmp/zlib.tar.bz2 -d 'a comment'", $output, $retval);
57  //print_r($output);
58  $this->assertPattern('/ERROR, -p /', $output[0]);
59  }
60 
61  function TestMissingDashN()
62  {
63 
64  // Note you must have a valid archive
65  $error = exec("$this->command -p foo -a /tmp/zlib.tar.bz2 -d 'a comment'", $output, $retval);
66  //print_r($output);
67  $this->assertPattern('/ERROR, -n /', $output[0]);
68  }
69 
70  function TestMissingDasha()
71  {
72  // Note you must have a valid archive
73  $error = exec("$this->command -p baz -n foo -d 'a comment'", $output, $retval);
74  //print_r($output);
75  $this->assertPattern('/ERROR, -a /', $output[0]);
76  }
77 }
78