blob: cda84dbaf0a0cd9aa408d0d042d2a32ad0caa370 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
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"));
}
}
}
?>
|