aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Tunnicliffe <james.tunnicliffe@linaro.org>2012-06-26 15:21:05 +0100
committerJames Tunnicliffe <james.tunnicliffe@linaro.org>2012-06-26 15:21:05 +0100
commit57c193f3bafac5093b121fec5746636971d17a8e (patch)
tree1a730bc1692d4b718461583e1d8da2fa69ddebe4
parent52cda112bdbff60e85f5108f1d23004f223dcc8f (diff)
Deleted PHP tests.
Deleted HEADER.html (only needed for PHP implementation)
-rw-r--r--HEADER.html15
-rw-r--r--tests/BUILD-INFO.txt18
-rw-r--r--tests/BuildInfoTest.php244
-rw-r--r--tests/LicenseHelperTest.php177
-rw-r--r--tests/mime.types11
-rw-r--r--tests/test_php_unit.py40
6 files changed, 0 insertions, 505 deletions
diff --git a/HEADER.html b/HEADER.html
deleted file mode 100644
index 32bf42a..0000000
--- a/HEADER.html
+++ /dev/null
@@ -1,15 +0,0 @@
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <title>Linaro Snapshots</title>
- <link rel="stylesheet" type="text/css" href="resources/css/ext-all.css" />
- <link href="http://www.linaro.org/remote/css/init.css" rel="stylesheet" type="text/css" >
- <link href="http://www.linaro.org/remote/css/remote.css" rel="stylesheet" type="text/css" >
- <script language="javascript" type="text/javascript" src="http://www.linaro.org/remote/js/linarofamily.js"></script>
-</head>
-<body>
-<div id="head">
-<h1>Linaro Snapshots</h1>
-</div>
-<div id="content">
-</body>
-
diff --git a/tests/BUILD-INFO.txt b/tests/BUILD-INFO.txt
deleted file mode 100644
index 617f74b..0000000
--- a/tests/BUILD-INFO.txt
+++ /dev/null
@@ -1,18 +0,0 @@
-Format-Version: 0.1
-Files-Pattern: *.txt
-Build-Name: landing-snowball
-Theme: stericsson
-License-Type: open
-OpenID-Launchpad-Teams: linaro,non-linaro
-Collect-User-Data: yes
-License-Text: <p>IMPORTANT — PLEASE READ THE FOLLOWING AGREEMENT CAREFULLY.</p>
- <p>
- THIS IS A LEGALLY BINDING AGREEMENT BETWEEN YOU, an individual or a
- legal entity, (“LICENSEE”) AND SAMSUNG ELECTRONICS CO.,
- LTD. (“SAMSUNG”). BY CLICKING THE "ACCEPT" BUTTON, OR BY DOWNLOADING OR
- INSTALLING OR OTHERWISE USING THE SOFTWARE, YOU AGREE TO BE BOUND BY THE
- TERMS OF THIS AGREEMENT. IF YOU DO NOT AGREE TO THE TERMS OF THIS
- AGREEMENT OR ARE NOT AUTHORISED TO ACCEPT AND AGREE TO THE TERMS OF THE
- AGREEMENT ON BEHALF OF YOUR LEGAL ENTITY, DO NOT DOWNLOAD, INSTALL OR
- OTHERWISE USE THE SOFTWARE.
- </p>
diff --git a/tests/BuildInfoTest.php b/tests/BuildInfoTest.php
deleted file mode 100644
index 14f9dc8..0000000
--- a/tests/BuildInfoTest.php
+++ /dev/null
@@ -1,244 +0,0 @@
-<?php
-
-require_once("licenses/BuildInfo.php");
-
-class BuildInfoTest extends PHPUnit_Framework_TestCase
-{
-
- private $temp_filename;
- private $good_bi;
- private $empty_bi;
- private $fname;
-
- public function setUp()
- {
- $this->good_bi = new BuildInfo("tests/BUILD-INFO.txt");
- $this->temp_filename = tempnam(sys_get_temp_dir(), "build-info");
- $this->empty_bi = new BuildInfo($this->temp_filename);
- $this->fname = "BUILD-INFO.txt";
- }
-
- public function tearDown() {
- if (file_exists($this->temp_filename)) {
- unlink($this->temp_filename);
- }
- }
-
- /**
- * @expectedException InvalidArgumentException
- */
- public function test_parseLine_fails() {
- $line = "no separator";
- $buildinfo = new BuildInfo("");
- $buildinfo->parseLine($line);
- }
-
- public function test_parseLine_passes() {
- $line = "Build-Name:value";
- $buildinfo = new BuildInfo("");
- $this->assertEquals(array("Build-Name" => "value"),
- $buildinfo->parseLine($line));
- }
-
- public function test_parseLine_trims() {
- $line = "Build-Name: value";
- $buildinfo = new BuildInfo("");
- $this->assertEquals(array("Build-Name" => "value"),
- $buildinfo->parseLine($line));
- }
-
- /**
- * @expectedException InvalidArgumentException
- */
- public function test_parseLine_invalid_field() {
- $line = "field: value";
- $buildinfo = new BuildInfo("");
- $this->assertEquals(array("field" => "value"),
- $buildinfo->parseLine($line));
- }
-
- public function test_isValidField_true() {
- $buildinfo = new BuildInfo("");
- $fields_allowed = array("Format-Version", "Files-Pattern",
- "Build-Name", "Theme", "License-Type", "OpenID-Launchpad-Teams",
- "Collect-User-Data", "License-Text");
- foreach ($fields_allowed as $field) {
- $this->assertTrue($buildinfo->isValidField($field));
- }
- }
-
- public function test_isValidField_false() {
- $buildinfo = new BuildInfo("");
- $this->assertFalse($buildinfo->isValidField("Some random text"));
- }
-
- /**
- * @expectedException InvalidArgumentException
- */
- public function test_parseData_fails() {
- $buildinfo = new BuildInfo("");
- $buildinfo->parseData(array("Arbitrary text"));
- }
-
- /**
- * @expectedException InvalidArgumentException
- */
- public function test_parseData_array_expected() {
- $buildinfo = new BuildInfo("");
- $buildinfo->parseData("Arbitrary text");
- }
-
- public function test_parseData_format_version() {
- $buildinfo = new BuildInfo("");
- $values = $buildinfo->parseData(array("Format-Version: 2.0"));
- $this->assertEquals(array("Format-Version" => "2.0"),
- $values);
- }
-
- public function test_parseData_extra_fields() {
- $buildinfo = new BuildInfo("");
- $values = $buildinfo->parseData(array(
- "Format-Version: 2.0",
- "Files-Pattern: *.txt",
- "Build-Name: woohoo"));
- $this->assertEquals(array("Format-Version" => "2.0",
- "*.txt" => array("Build-Name" => "woohoo")),
- $values);
- }
-
- public function test_parseBlock_license() {
- $buildinfo = new BuildInfo("");
- $lineno = 0;
- $values = $buildinfo->parseBlock(array(
- "Format-Version: 2.0",
- "License-Text: line1",
- " line2"), $lineno);
- $this->assertEquals(array("Format-Version" => "2.0",
- "License-Text" => "line1\nline2"),
- $values);
- }
-
- public function test_parseContinuation_no_continuation() {
- $buildinfo = new BuildInfo("");
- $lineno = 0;
- $this->assertEquals(
- "",
- $buildinfo->parseContinuation(array("no-space"), $lineno));
- }
-
- public function test_parseContinuation_indexed() {
- $buildinfo = new BuildInfo("");
- $lineno = 0;
- $this->assertEquals("",
- $buildinfo->parseContinuation(array("no-space", " space"), $lineno));
- }
-
- public function test_parseContinuation() {
- $buildinfo = new BuildInfo("");
- $lineno = 1;
- $value = $buildinfo->parseContinuation(array("no-space", " line1", " line2"), $lineno);
- $this->assertEquals("\nline1\nline2", $value);
- }
-
- /**
- * @expectedException InvalidArgumentException
- */
- public function test_parseData_no_format_version_fails() {
- $buildinfo = new BuildInfo("");
- $values = $buildinfo->parseData(array("Build-Name: blah"));
- }
-
- public function test_parseData_blocks() {
- $buildinfo = new BuildInfo("");
- $lineno = 0;
- $values = $buildinfo->parseData(array("Format-Version: 2.0",
- "Files-Pattern: *.txt",
- "Build-Name: woohoo",
- "Files-Pattern: *.tgz",
- "Build-Name: weehee"));
- $this->assertEquals(array("Format-Version" => "2.0",
- "*.txt" => array("Build-Name" => "woohoo"),
- "*.tgz" => array("Build-Name" => "weehee")),
- $values);
- }
-
- public function test_parseData_block_multiple_patterns() {
- $buildinfo = new BuildInfo("");
- $lineno = 0;
- $values = $buildinfo->parseData(array("Format-Version: 2.0",
- "Files-Pattern: *.txt,*.tgz",
- "Build-Name: weehee"));
- $this->assertEquals(array("Format-Version" => "2.0",
- "*.txt" => array("Build-Name" => "weehee"),
- "*.tgz" => array("Build-Name" => "weehee")),
- $values);
- }
-
-
- /**
- * Running readFile on a directory returns false.
- */
- public function test_readFile_nonFile()
- {
- $bi = new BuildInfo(dirname(__FILE__));
- $this->assertFalse($bi->readFile());
- }
-
- /**
- * Running readFile on a nonexistent file returns false.
- */
- public function test_readFile_nonexistentFile()
- {
- $bi = new BuildInfo("nonexistent.file");
- $this->assertFalse($bi->readFile());
- }
-
- /**
- * Running readFile on a regular file returns array of strings.
- */
- public function test_readFile_file()
- {
- $bi = new BuildInfo("tests/BUILD-INFO.txt");
- $this->assertInternalType('array', $bi->readFile());
- }
-
- /**
- * Running 'get' functions on an empty fields returns false.
- */
- public function test_getFormatVersion_empty()
- {
- $this->assertFalse($this->empty_bi->getFormatVersion());
- }
-
- /**
- * Running 'get' functions on non-empty fields returns string value.
- */
- public function test_getFormatVersion_type()
- {
- $this->assertInternalType(
- 'string', $this->good_bi->getFormatVersion());
- }
-
- public function test_getFormatVersion()
- {
- $this->assertEquals('0.1', $this->good_bi->getFormatVersion());
- }
-
- public function test_getBuildName_empty()
- {
- $this->assertFalse($this->empty_bi->get("Build-Name"));
- }
-
- public function test_getBuildName_type()
- {
- $this->assertInternalType(
- 'string', $this->good_bi->get("Build-Name"));
- }
-
- public function test_getBuildName()
- {
- $this->assertEquals(
- 'landing-snowball', $this->good_bi->get("Build-Name"));
- }
-}
-?>
diff --git a/tests/LicenseHelperTest.php b/tests/LicenseHelperTest.php
deleted file mode 100644
index a3a753f..0000000
--- a/tests/LicenseHelperTest.php
+++ /dev/null
@@ -1,177 +0,0 @@
-<?php
-
-require_once("licenses/LicenseHelper.php");
-
-class LicenseHelperTest extends PHPUnit_Framework_TestCase
-{
-
- private $temp_filename;
- private $temp_link;
-
- public function setUp() {
- $this->temp_link = sys_get_temp_dir() . "/temp_link";
- }
-
- public function tearDown() {
- if (file_exists($this->temp_link)) {
- unlink($this->temp_link);
- }
- }
-
-
- /**
- * Running checkFile on a directory path returns false.
- */
- public function test_checkFile_nonFile()
- {
- $this->assertFalse(LicenseHelper::checkFile(dirname(__FILE__)));
- }
-
- /**
- * Running checkFile on a symbolic link to an existing file returns true.
- */
- public function test_checkFile_link()
- {
- $this->temp_filename = tempnam(sys_get_temp_dir(), "unittest");
- symlink($this->temp_filename, $this->temp_link);
-
- $this->assertTrue(LicenseHelper::checkFile($this->temp_link));
-
- unlink($this->temp_filename);
- }
-
- /**
- * Running checkFile on a broken symbolic link returns true.
- * This is because PHP function is_link returns true on broken soft links.
- */
- public function test_checkFile_brokenLink()
- {
- $this->temp_filename = tempnam(sys_get_temp_dir(), "unittest");
- symlink($this->temp_filename, $this->temp_link);
-
- $this->assertTrue(LicenseHelper::checkFile($this->temp_link));
-
- unlink($this->temp_filename);
- }
-
- /**
- * Running checkFile on a regular file returns true.
- */
- public function test_checkFile_file()
- {
- $this->assertTrue(LicenseHelper::checkFile(__FILE__));
- }
-
- /**
- * getFileList throws an InvalidArgumentException when passed
- * an argument pointing to a file.
- * @expectedException InvalidArgumentException
- */
- public function test_getFilesList_file()
- {
- $file_list = LicenseHelper::getFilesList(__FILE__);
- }
-
- /**
- * getFileList returns a list of filenames in that directory.
- */
- public function test_getFilesList_dir()
- {
- $temp_dir_name = tempnam(sys_get_temp_dir(), "unittest");
- if (file_exists($temp_dir_name)) {
- unlink($temp_dir_name);
- }
- mkdir($temp_dir_name);
-
- touch($temp_dir_name . "/unittest1");
- touch($temp_dir_name . "/unittest2");
-
- $file_list = LicenseHelper::getFilesList($temp_dir_name);
- $this->assertCount(2, $file_list);
-
- // Sort the file list, this function returns the files as they are
- // written on the filesystem.
- sort($file_list);
- $this->assertEquals("unittest1", $file_list[0]);
- $this->assertEquals("unittest2", $file_list[1]);
-
- unlink($temp_dir_name . "/unittest1");
- unlink($temp_dir_name . "/unittest2");
- rmdir($temp_dir_name);
- }
-
- /**
- * Running findFileByPattern on an array without matches returns false.
- */
- public function test_findFileByPattern_noMatch()
- {
- $file_list = array("test.txt", "new_file.pdf");
- $pattern = "/^abc/";
- $this->assertFalse(
- LicenseHelper::findFileByPattern($file_list, $pattern));
- }
-
- /**
- * Running findFileByPattern on an array with matches returns first
- * matching element.
- */
- public function test_findFileByPattern_match()
- {
- $file_list = array("test.txt", "new_file.pdf");
- $pattern = "/test/";
- $this->assertEquals("test.txt",
- LicenseHelper::findFileByPattern($file_list,
- $pattern));
- }
-
- /**
- * getTheme returns a ST-E Linaro-branded template when
- * no EULA is present (indicated by eula filename being named
- * EULA.txt or not).
- */
- public function test_getTheme_noEula_snowball()
- {
- $eula = "EULA.txt";
- $filename = "snowball.build.tar.bz2";
- $this->assertEquals("ste", LicenseHelper::getTheme($eula, $filename));
- }
-
- /**
- * getTheme returns a Samsung Linaro-branded template when
- * no EULA is present (indicated by eula filename being named
- * EULA.txt or not).
- */
- public function test_getTheme_noEula_origen()
- {
- $eula = "EULA.txt";
- $filename = "origen.build.tar.bz2";
- $this->assertEquals("samsung",
- LicenseHelper::getTheme($eula, $filename));
- }
-
- /**
- * getTheme returns a generic Linaro-branded template when
- * no EULA is present (indicated by eula filename being named
- * EULA.txt or not).
- */
- public function test_getTheme_noEula_generic()
- {
- $eula = "EULA.txt";
- $filename = "build.tar.bz2";
- $this->assertEquals("linaro",
- LicenseHelper::getTheme($eula, $filename));
- }
-
- /**
- * Running getTheme with eula file present (indicated by eula filename
- * being named EULA.txt or not) returns extension of eula file.
- */
- public function test_getTheme_eula()
- {
- $eula = "EULA.txt.test";
- $this->assertEquals("test", LicenseHelper::getTheme($eula, ""));
- }
-
-}
-
-?>
diff --git a/tests/mime.types b/tests/mime.types
deleted file mode 100644
index c4a3984..0000000
--- a/tests/mime.types
+++ /dev/null
@@ -1,11 +0,0 @@
-text/css css
-text/directory
-text/html html htm shtml
-text/plain asc txt text pot brf
-text/uri-list
-application/x-httpd-php phtml pht php
-application/x-httpd-php-source phps
-application/x-httpd-php3 php3
-application/x-httpd-php3-preprocessed php3p
-application/x-httpd-php4 php4
-application/x-httpd-php5 php5
diff --git a/tests/test_php_unit.py b/tests/test_php_unit.py
deleted file mode 100644
index f7d9e93..0000000
--- a/tests/test_php_unit.py
+++ /dev/null
@@ -1,40 +0,0 @@
-import os
-import tempfile
-import subprocess
-import xml.etree.ElementTree
-
-from testtools import TestCase
-from testtools.matchers import Equals
-from testtools.matchers import AllMatch
-
-from tests.test_click_through_license import CommandNotFoundException
-
-
-class PhpUnitTest(TestCase):
- '''Tests for executing the PHP Unit tests'''
-
- def setUp(self):
- super(PhpUnitTest, self).setUp()
- self.xml_path = tempfile.mkstemp()[1]
- returncode = subprocess.Popen(['phpunit', '--log-junit',
- self.xml_path, 'tests'],
- stdout=open('/dev/null', 'w'),
- stderr=subprocess.STDOUT).wait()
- if returncode == -1:
- raise CommandNotFoundException("phpunit command not found. Please "
- "install phpunit package and rerun tests.")
- self.xml_data = xml.etree.ElementTree.parse(self.xml_path)
-
- def tearDown(self):
- super(PhpUnitTest, self).tearDown()
- if os.path.exists(self.xml_path):
- os.unlink(self.xml_path)
-
- def test_run_php_unit_tests(self):
- self.assertThat(
- [
- self.xml_data.getroot()[0].attrib['failures'],
- self.xml_data.getroot()[0].attrib['errors']
- ],
- AllMatch(Equals("0"))
- )