-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDatabaseTest.php
More file actions
56 lines (42 loc) · 1.55 KB
/
DatabaseTest.php
File metadata and controls
56 lines (42 loc) · 1.55 KB
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
47
48
49
50
51
52
53
54
55
56
<?php
namespace cases\database;
use ocunit\library\MySQLPDO;
use PHPUnit\Framework\TestCase;
class DatabaseTest extends TestCase
{
public function testCanConnectToTheDatabase()
{
$pdo = new MySQLPDO();
$this->assertNotNull($pdo, "Failed connecting to the database.");
}
public function testSingleCurrency()
{
$pdo = new MySQLPDO();
$sql = "SELECT * FROM `" . DB_PREFIX . "currency` WHERE STATUS='1';";
$data = $pdo->query($sql);
$this->assertTrue(count($data) == 1, "Several currencies are active: Ensure that your business supports them.");
}
public function testOnlyOneLanguageIsActive()
{
$pdo = new MySQLPDO();
$sql = "SELECT COUNT(*) total FROM `" . DB_PREFIX . "language`;";
$data = $pdo->query($sql);
$total = (int)$data[0]["total"];
/**
* Do NOT add multiple languages.
* Default language should be eb-gb with id 1.
*/
$this->assertEquals(1, $total);
}
public function testAdminPaginates100Items()
{
$pdo = new MySQLPDO();
$sql = "SELECT * FROM `" . DB_PREFIX . "setting` WHERE `key`='config_pagination_admin';";
$data = $pdo->query($sql);
// @todo Load pagination size from config
//global $configurations;
//$admin_pagination = $configurations["settings"]["admin_pagination"];
$admin_pagination = 100;
$this->assertEquals($admin_pagination, (int)$data[0]["value"]);
}
}