Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/tests/flysprayTest.php
diff options
context:
space:
mode:
authorAndreas Baumann <mail@andreasbaumann.cc>2020-02-01 09:05:48 +0100
committerAndreas Baumann <mail@andreasbaumann.cc>2020-02-01 09:05:48 +0100
commit6854cb3f4d8219cf1829e32122eb2502a916eae9 (patch)
tree350feb504587d932e02837a1442b059759927646 /tests/flysprayTest.php
initial checkin
Diffstat (limited to 'tests/flysprayTest.php')
-rw-r--r--tests/flysprayTest.php46
1 files changed, 46 insertions, 0 deletions
diff --git a/tests/flysprayTest.php b/tests/flysprayTest.php
new file mode 100644
index 0000000..cda84db
--- /dev/null
+++ b/tests/flysprayTest.php
@@ -0,0 +1,46 @@
+<?php
+
+use PHPUnit\Framework\TestCase;
+
+class FlysprayTest extends TestCase{
+ #private $pdo;
+ private $db;
+
+ # just taken as first test from github project travis-ci-examples/php
+ protected function setUp(): void
+ {
+ #$this->pdo = new PDO($GLOBALS['db_dsn'], $GLOBALS['db_username'], $GLOBALS['db_password']);
+ #$this->pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
+ #$this->pdo->query("CREATE TABLE hello (what VARCHAR(50) NOT NULL)");
+ $this->db = new Database;
+ $this->db->dbOpen($GLOBALS['dbhost'], $GLOBALS['dbuser'], $GLOBALS['dbpass'], $GLOBALS['dbname'], $GLOBALS['dbtype'], $GLOBALS['dbprefix']);
+ $this->db->query("CREATE TABLE {projects} (what VARCHAR(50) NOT NULL)");
+ }
+ public function tearDown(): void
+ {
+ #$this->pdo->query("DROP TABLE hello");
+ $this->db->query("DROP TABLE {projects}");
+ }
+
+ public function testHelloWorld(){
+ $helloWorld = 'Hello World';
+ $this->assertEquals('Hello World', $helloWorld);
+ }
+
+ public function testTranslationSyntax(){
+ if ($handle = opendir('lang')) {
+ $languages=array();
+ while (false !== ($file = readdir($handle))) {
+ # exclude temporary files from onsite translations
+ if ($file != "." && $file != ".." && !(substr($file,-4)=='.bak') && !(substr($file,-5)=='.safe') ) {
+ $langfiles[]=$file;
+ }
+ }
+ }
+
+ foreach($langfiles as $lang){
+ $this->assertStringStartsWith('No syntax errors', shell_exec("php -l lang/$lang"));
+ }
+ }
+}
+?>