FOSSology  3.2.0rc1
Open Source License Compliance by Open Source Software
OneShot-affero.php
Go to the documentation of this file.
1 <?php
2 /***********************************************************
3  Copyright (C) 2012 Hewlett-Packard Development Company, L.P.
4  Copyright (C) 2015 Siemens AG
5 
6  This program is free software; you can redistribute it and/or
7  modify it under the terms of the GNU General Public License
8  version 2 as published by the Free Software Foundation.
9 
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License along
16  with this program; if not, write to the Free Software Foundation, Inc.,
17  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18  ***********************************************************/
19 require_once ('CommonCliTest.php');
34 {
39  public $affero1;
44  public $affero3;
45 
53  public function testOneShotafferos()
54  {
55  /* check to see if the file exists */
56  $this->affero1 = dirname(dirname(dirname(dirname(__FILE__)))).'/testing/dataFiles/TestData/licenses/Affero-v1.0';
57  $this->affero3 = dirname(dirname(dirname(dirname(__FILE__)))).'/testing/dataFiles/TestData/licenses/agpl-3.0.txt';
58  $this->assertFileExists($this->affero1,"OneShotaffero1Test FAILURE! $this->affero1 not found\n");
59  $this->assertFileExists($this->affero3,"OneShotaffero1Test FAILURE! $this->affero3 not found\n");
60 
61  list($output,) = $this->runNomos("",array($this->affero1));
62  list(,$fname1,,,$license1) = explode(' ', $output);
63  $this->assertEquals($fname1, 'Affero-v1.0', "Error processed filename $fname1
64  does not equal Affero-v1.0");
65  $this->assertEquals(trim($license1), 'AGPL-1.0', "Error license does not equal Affero_v1,
66  $license1 was returned");
67 
68  list($out3,) = $this->runNomos("",array($this->affero3));
69  list(,$fname,,,$license) = explode(' ', $out3);
70  $this->assertEquals($fname, 'agpl-3.0.txt', "Error processed filename $fname
71  does not equal agpl-3.0.txt");
72  $this->assertEquals(trim($license), 'AGPL-3.0', "Error license
73  does not equal Affero_v3, $license was returned");
74  }
75 }
Perform a one-shot license analysis on a affero 2 and 3 licenses.
runNomos($args="", $files=array())
Run nomos using the arguments passed.
Tests for common CLI operations.
testOneShotafferos()
Run NOMOS on affero1 and affero3.
list_t type structure used to keep various lists. (e.g. there are multiple lists).
Definition: nomos.h:321
char * trim(char *ptext)
Trimming whitespace.
Definition: fossconfig.c:695