OciAdapterTest.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. include 'helpers/config.php';
  3. require_once __DIR__ . '/../lib/adapters/OciAdapter.php';
  4. class OciAdapterTest extends AdapterTest
  5. {
  6. public function set_up($connection_name=null)
  7. {
  8. parent::set_up('oci');
  9. }
  10. public function test_get_sequence_name()
  11. {
  12. $this->assert_equals('authors_seq',$this->conn->get_sequence_name('authors','author_id'));
  13. }
  14. public function test_columns_text()
  15. {
  16. $author_columns = $this->conn->columns('authors');
  17. $this->assert_equals('varchar2',$author_columns['some_text']->raw_type);
  18. $this->assert_equals(100,$author_columns['some_text']->length);
  19. }
  20. public function test_datetime_to_string()
  21. {
  22. $this->assert_equals('01-Jan-2009 01:01:01 AM',$this->conn->datetime_to_string(date_create('2009-01-01 01:01:01 EST')));
  23. }
  24. public function test_date_to_string()
  25. {
  26. $this->assert_equals('01-Jan-2009',$this->conn->date_to_string(date_create('2009-01-01 01:01:01 EST')));
  27. }
  28. public function test_insert_id() {}
  29. public function test_insert_id_with_params() {}
  30. public function test_insert_id_should_return_explicitly_inserted_id() {}
  31. public function test_columns_time() {}
  32. public function test_columns_sequence() {}
  33. public function test_set_charset()
  34. {
  35. $connection_string = ActiveRecord\Config::instance()->get_connection($this->connection_name);
  36. $conn = ActiveRecord\Connection::instance($connection_string . '?charset=utf8');
  37. $this->assert_equals(';charset=utf8', $conn->dsn_params);
  38. }
  39. }
  40. ?>