diff options
author | ctrlaltca <> | 2012-07-12 11:21:01 +0000 |
---|---|---|
committer | ctrlaltca <> | 2012-07-12 11:21:01 +0000 |
commit | 903ae8a581fac1e6917fc3e31d2ad8fb91df80c3 (patch) | |
tree | e08bf04f0823650a231227ac3499121270172a23 /tests/simple_unit/TableGateway/TableGatewayPgsqlTest.php | |
parent | 3e4e6e66aeb3f8fea4e1eb4237498ef9d2358f63 (diff) |
standardize the use of unix eol; use svn properties to enforce native eol
Diffstat (limited to 'tests/simple_unit/TableGateway/TableGatewayPgsqlTest.php')
-rw-r--r-- | tests/simple_unit/TableGateway/TableGatewayPgsqlTest.php | 106 |
1 files changed, 53 insertions, 53 deletions
diff --git a/tests/simple_unit/TableGateway/TableGatewayPgsqlTest.php b/tests/simple_unit/TableGateway/TableGatewayPgsqlTest.php index 4d1077f7..f34dcefc 100644 --- a/tests/simple_unit/TableGateway/TableGatewayPgsqlTest.php +++ b/tests/simple_unit/TableGateway/TableGatewayPgsqlTest.php @@ -1,56 +1,56 @@ <?php -require_once(dirname(__FILE__).'/BaseGatewayTest.php');
-
-class TableGatewayPgsqlTest extends BaseGatewayTest
-{
-
- function test_update()
- {
- $this->add_record1();
- $address = array('username' => 'tester 1', 'field5_text'=>null);
- $result = $this->getGateway()->update($address, 'username = ?', 'Username');
- $this->assertTrue($result);
-
- $test = $this->getGateway()->find('username = ?', 'tester 1');
- unset($test['id']);
- $expect = $this->get_record1();
- $expect['username'] = 'tester 1';
- $expect['field5_text'] = null;
- unset($expect['field7_timestamp']); unset($test['field7_timestamp']);
- $this->assertEqual($expect, $test);
-
- $this->assertTrue($this->getGateway()->deleteAll('username = ?', 'tester 1'));
- }
-
- function test_update_named()
- {
- $this->add_record1();
- $address = array('username' => 'tester 1', 'field5_text'=>null);
- $result = $this->getGateway()->update($address, 'username = :name', array(':name'=>'Username'));
- $this->assertTrue($result);
-
- $test = $this->getGateway()->find('username = :name', array(':name'=>'tester 1'));
- unset($test['id']);
- $expect = $this->get_record1();
- $expect['username'] = 'tester 1';
- $expect['field5_text'] = null;
- unset($expect['field7_timestamp']); unset($test['field7_timestamp']);
- $this->assertEqual($expect, $test);
-
- $this->assertTrue($this->getGateway()->deleteAll('username = :name', array(':name'=>'tester 1')));
- }
-
- function test_find_all()
- {
- $this->add_record1();
- $this->add_record2();
-
- $results = $this->getGateway()->findAll('true')->readAll();
- $this->assertEqual(count($results), 2);
-
- $result = $this->getGateway()->findAllBySql('SELECT username FROM address WHERE phone = ?', '45233')->read();
- $this->assertEqual($result['username'], 'record2');
- }
-
+require_once(dirname(__FILE__).'/BaseGatewayTest.php'); + +class TableGatewayPgsqlTest extends BaseGatewayTest +{ + + function test_update() + { + $this->add_record1(); + $address = array('username' => 'tester 1', 'field5_text'=>null); + $result = $this->getGateway()->update($address, 'username = ?', 'Username'); + $this->assertTrue($result); + + $test = $this->getGateway()->find('username = ?', 'tester 1'); + unset($test['id']); + $expect = $this->get_record1(); + $expect['username'] = 'tester 1'; + $expect['field5_text'] = null; + unset($expect['field7_timestamp']); unset($test['field7_timestamp']); + $this->assertEqual($expect, $test); + + $this->assertTrue($this->getGateway()->deleteAll('username = ?', 'tester 1')); + } + + function test_update_named() + { + $this->add_record1(); + $address = array('username' => 'tester 1', 'field5_text'=>null); + $result = $this->getGateway()->update($address, 'username = :name', array(':name'=>'Username')); + $this->assertTrue($result); + + $test = $this->getGateway()->find('username = :name', array(':name'=>'tester 1')); + unset($test['id']); + $expect = $this->get_record1(); + $expect['username'] = 'tester 1'; + $expect['field5_text'] = null; + unset($expect['field7_timestamp']); unset($test['field7_timestamp']); + $this->assertEqual($expect, $test); + + $this->assertTrue($this->getGateway()->deleteAll('username = :name', array(':name'=>'tester 1'))); + } + + function test_find_all() + { + $this->add_record1(); + $this->add_record2(); + + $results = $this->getGateway()->findAll('true')->readAll(); + $this->assertEqual(count($results), 2); + + $result = $this->getGateway()->findAllBySql('SELECT username FROM address WHERE phone = ?', '45233')->read(); + $this->assertEqual($result['username'], 'record2'); + } + } ?>
\ No newline at end of file |