-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfunctionstest.php
68 lines (57 loc) · 1.57 KB
/
functionstest.php
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
57
58
59
60
61
62
63
64
65
66
67
68
<?php
/**
* @file
* Test harness for functions.
*
*/
require_once('functions.php');
//require_once('PHPUnit.php');
// https://pear.php.net/package/PHPUnit/docs/latest/PHPUnit/PHPUnit_TestCase.html
class FunctionsTest extends PHPUnit_Framework_TestCase {
// contains the internal data, for the test @TODO
var $data;
// called before the test functions will be executed this function is
// defined in PHPUnit_TestCase and overwritten here
function setUp() {
}
// called after the test functions are executed this function is defined in
// PHPUnit_TestCase and overwritten here
function tearDown() {
}
function testConnect() {
$pdo = connect();
$this->assertNotNull($pdo);
}
function testRoomAdd() {
$room = empty_room(1313);
$room['rate'] = 1234;
$room['bedsize'] = 'king';
$room['sleeps'] = 2;
$this->assertEquals(room_update($room), 1);
}
function testRoomUpdate() {
$room = empty_room(1313);
$room['rate'] = 3456;
$room['bedsize'] = '2 double';
$room['sleeps'] = 4;
$this->assertTrue(room_update($room) > 0);
}
function testRoom() {
$row = room(1313);
$this->assertNotNull($row);
if ($row) {
$this->assertEquals($row['rid'], 1313);
$this->assertEquals($row['bedsize'], '2 double');
$this->assertEquals($row['sleeps'], 4);
}
}
function testRoomList() {
$rows = roomlist();
$this->assertTrue($rows->rowCount() > 0);
}
function testRoomDelete() {
//$this->assertEquals(room_delete(1313), 1);
$cnt = room_delete(1313);
$this->assertEquals($cnt, 1);
}
}