26 public $fo_copyright_list_path;
30 private $testInstaller;
32 protected function setUp()
34 $this->testDb =
new TestPgDb(
"fossclitest");
35 $tables = array(
'users',
'upload',
'uploadtree_a',
'uploadtree',
'copyright',
'groups',
'group_user_member',
'agent',
'copyright_decision',
'copyright_ars',
'ars_master');
36 $this->testDb->createPlainTables($tables);
37 $this->testDb->createInheritedTables(array(
'uploadtree_a'));
38 $this->testDb->createInheritedArsTables(array(
'copyright'));
39 $this->testDb->insertData($tables);
41 $sysConf = $this->testDb->getFossSysConf();
42 $this->fo_copyright_list_path = dirname(__DIR__) .
'/fo_copyright_list -c '.$sysConf;
45 $this->testInstaller->init();
48 protected function tearDown()
51 $this->testInstaller->clear();
52 $this->testDb->fullDestruct();
57 function test_get_copyright_list_all()
60 $auth =
"--user fossy --password fossy";
62 $command =
"$this->fo_copyright_list_path $auth -u $upload_id -t $uploadtree_id --container 1";
63 exec(
"$command 2>&1", $output, $return_value);
65 $this->assertEquals(0, $return_value,
"Non-zero exit status code with\n" . join(
'\n', $output));
66 $this->assertEquals(27, count($output));
67 $this->assertEquals(
"B.zip/B/1b/AAL_B: copyright (c) 2002 by author", $output[22]);
70 function test_get_copryright_list_email()
73 $auth =
"--user fossy --password fossy";
75 $command =
"$this->fo_copyright_list_path $auth -u $upload_id -t $uploadtree_id --type email --container 1";
76 exec(
"$command 2>&1", $output, $return_value);
78 $this->assertEquals(0, $return_value,
"Non-zero exit status code with\n" . join(
'\n', $output));
79 $this->assertEquals(
"B.zip/B/1b/3DFX_B: info@3dfx.com", $output[7]);
82 function test_get_copryright_list_withoutContainer()
85 $auth =
"--user fossy --password fossy";
87 $command =
"$this->fo_copyright_list_path $auth -u $upload_id -t $uploadtree_id --type email --container 0";
88 exec(
"$command 2>&1", $output, $return_value);
90 $this->assertEquals(0, $return_value,
"Non-zero exit status code with\n" . join(
'\n', $output));
91 $this->assertEquals(
"B.zip/B/1b/3DFX_B: info@3dfx.com", $output[4]);
94 public function test_help()
96 $auth =
"--user fossy --password fossy";
97 $command =
"$this->fo_copyright_list_path $auth -h";
98 exec(
"$command 2>&1", $output, $return_value);
100 $this->assertEquals(0, $return_value,
"Non-zero exit status code with\n" . join(
'\n', $output));
101 $this->assertEquals(11, count($output));
104 public function test_help_noAuthentication()
106 $command =
"$this->fo_copyright_list_path -h";
107 exec(
"$command 2>&1", $output, $return_value);
109 $this->assertEquals(0, $return_value,
"Non-zero exit status code with\n" . join(
'\n', $output));
110 $this->assertEquals(11, count($output));