Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Sonar Support

Modified the Unittests in such a way that they can be run automatically
from Sonar.
  • Loading branch information...
commit d809c6aaebdc521bf28659f637026d5a07fe24d0 1 parent 91070a5
@jeroenrnl authored
View
2  .gitignore
@@ -1 +1,3 @@
/php/UnitTests/output/
+.sonar
+.images
View
3  php/UnitTests/anonymousUserTest.php
@@ -20,8 +20,7 @@
* @package ZophUnitTest
* @author Jeroen Roos
*/
-require_once("testSetup.php");
-
+require_once("php/UnitTests/testSetup.php");
/**
* Test class for anonymousUser.
* @package ZophUnitTest
View
8 php/UnitTests/cliTest.php
@@ -289,18 +289,18 @@ private function checkFilesExistAndCleanFiles($dir, $file) {
);
foreach($prefixes as $prefix) {
if(!empty($prefix)) {
- $filename=IMAGE_DIR . "/" . $dir . "/" . $prefix . "/" . $prefix . "_" . $file;
+ $filename=conf::get("path.images") . "/" . $dir . "/" . $prefix . "/" . $prefix . "_" . $file;
} else {
- $filename=IMAGE_DIR . "/" . $dir . "/" . $file;
+ $filename=conf::get("path.images") . "/" . $dir . "/" . $file;
}
$this->assertFileExists($filename);
unlink($filename);
if(!empty($prefix)) {
- @rmdir(IMAGE_DIR . "/" . $dir . "/" . $prefix);
+ @rmdir(conf::get("path.images") . "/" . $dir . "/" . $prefix);
}
}
- @rmdir(IMAGE_DIR . "/" . $dir);
+ @rmdir(conf::get("path.images") . "/" . $dir);
}
private function runCLI($cli) {
View
2  php/UnitTests/databaseTest.inc.php
@@ -41,7 +41,7 @@
}
final public function getDataSet() {
- return $this->createMySQLXMLDataSet('db.xml');
+ return $this->createMySQLXMLDataSet('php/UnitTests/db.xml');
}
}
?>
View
3  php/UnitTests/helpers.inc.php
@@ -27,6 +27,9 @@
class helpers {
public static function createTestImage($name, $bg, $fg, $exif) {
+ if(file_exists("/tmp/" . $name)) {
+ unlink("/tmp/" . $name);
+ }
$bgcolour=new ImagickPixel();
$bgcolour->setColor($bg);
View
30 php/UnitTests/phpunit.xml
@@ -6,28 +6,28 @@
<filter>
<blacklist>
<directory>/usr/share</directory>
- <directory>../UnitTests</directory>
+ <directory>php/UnitTests</directory>
</blacklist>
</filter>
<php>
- <const name="INSTANCE" value="zophtest" />
+ <const name="INSTANCE" value="zophgit" />
<const name="IMAGE_DIR" value="/data/images" />
</php>
<testsuites>
<testsuite name="Zoph">
- <file>userTest.php</file>
- <file>anonymousUserTest.php</file>
- <file>albumTest.php</file>
- <file>categoryTest.php</file>
- <file>groupTest.php</file>
- <file>groupPermissionsTest.php</file>
- <file>personTest.php</file>
- <file>photographerTest.php</file>
- <file>photoTest.php</file>
- <file>cliTest.php</file>
- <file>placeTest.php</file>
- <file>ratingTest.php</file>
- <file>relationTest.php</file>
+ <file>php/UnitTests/userTest.php</file>
+ <file>php/UnitTests/anonymousUserTest.php</file>
+ <file>php/UnitTests/albumTest.php</file>
+ <file>php/UnitTests/categoryTest.php</file>
+ <file>php/UnitTests/groupTest.php</file>
+ <file>php/UnitTests/groupPermissionsTest.php</file>
+ <file>php/UnitTests/personTest.php</file>
+ <file>php/UnitTests/photographerTest.php</file>
+ <file>php/UnitTests/photoTest.php</file>
+ <file>php/UnitTests/cliTest.php</file>
+ <file>php/UnitTests/placeTest.php</file>
+ <file>php/UnitTests/ratingTest.php</file>
+ <file>php/UnitTests/relationTest.php</file>
</testsuite>
</testsuites>
</phpunit>
View
7 php/UnitTests/testSetup.php
@@ -23,8 +23,8 @@
define("TEST", true);
-require_once("../settings.inc.php");
-require_once("../include.inc.php");
+//require_once("php/settings.inc.php");
+require_once("php/include.inc.php");
require_once("PHPUnit/Extensions/Database/TestCase.php");
require_once("PHPUnit/Extensions/Database/ITester.php");
require_once("PHPUnit/Extensions/Database/AbstractTester.php");
@@ -57,7 +57,6 @@
require_once("PHPUnit/Extensions/Database/DataSet/DefaultTableIterator.php");
require_once("databaseTest.inc.php");
require_once("helpers.inc.php");
-
user::setCurrent(new user(1));
-conf::set("path.images", IMAGE_DIR);
+conf::set("path.images", getcwd() . "/.images");
?>
View
11 sonar-project.properties
@@ -0,0 +1,11 @@
+sonar.projectKey=Zoph
+sonar.projectName=Zoph
+sonar.projectVersion=0.9.1
+
+sonar.projectDescription=Zoph Organizes Photos
+
+sonar.tests=php/UnitTests
+sonar.sources=php,cli
+sonar.language=php
+
+sonar.phpUnit.configuration=php/UnitTests/phpunit.xml
Please sign in to comment.
Something went wrong with that request. Please try again.