From 6854cb3f4d8219cf1829e32122eb2502a916eae9 Mon Sep 17 00:00:00 2001 From: Andreas Baumann Date: Sat, 1 Feb 2020 09:05:48 +0100 Subject: initial checkin --- tests/flysprayTest.php | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 tests/flysprayTest.php (limited to 'tests/flysprayTest.php') 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 @@ +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")); + } + } +} +?> -- cgit v1.2.3-70-g09d2