]> src.bluestatic.org Git - isso.git/blob - docs/UnitTest/DatabaseMySQLiTest.php
Updating the unit tests for preparation of renaming BSRegister to BSApp
[isso.git] / docs / UnitTest / DatabaseMySQLiTest.php
1 <?php
2
3 require_once 'PHPUnit/Framework.php';
4 require_once 'DatabaseTestAbstract.php';
5
6 class DatabaseMySQLiTest extends DatabaseTestAbstract
7 {
8 public function setUp()
9 {
10 require_once 'tests.config.php';
11 require_once 'ISSO/App.php';
12
13 $this->fixture = BSApp::LoadModule('DbMySqlI');
14 $this->fixture->connect(TEST_DB_MYSQL_HOST, TEST_DB_MYSQL_USER, TEST_DB_MYSQL_PASSWORD, TEST_DB_MYSQL_DATABASE);
15 $this->fixture->query("
16 CREATE TABLE test
17 (
18 id int auto_increment,
19 textstuff varchar(255),
20 PRIMARY KEY (id)
21 )
22 ");
23 }
24
25 public function tearDown()
26 {
27 $this->fixture->query("DROP TABLE test");
28 $this->fixture = null;
29 }
30
31 public function testConnect()
32 {
33 try
34 {
35 BSApp::LoadModule('DbMySqlI')->connect('localhost', '--invalid user--', '--invalid password--', '--nodatabase--');
36 $this->fail('exception expected');
37 }
38 catch (BSDbException $e)
39 {}
40 }
41 }
42
43 ?>