From a9b6e52ea8d301280a6320f510eb5af8f33ebd07 Mon Sep 17 00:00:00 2001 From: Mike Estes Date: Fri, 16 Aug 2013 22:08:19 -0700 Subject: [PATCH] Add static method `get_config` --- docs/configuration.rst | 10 ++++++++++ idiorm.php | 13 +++++++++++++ test/ConfigTest.php | 25 ++++++++++++++++++++++++- 3 files changed, 47 insertions(+), 1 deletion(-) diff --git a/docs/configuration.rst b/docs/configuration.rst index 395a1ebb..75d77f7e 100644 --- a/docs/configuration.rst +++ b/docs/configuration.rst @@ -65,6 +65,16 @@ once. 'etc' => 'etc' )); +Use the ``get_config`` method to read current settings. + +.. code-block:: php + + tearDownIdColumnOverrides(); } -} \ No newline at end of file + public function testGetConfig() { + $this->assertTrue(ORM::get_config('logging')); + ORM::configure('logging', false); + $this->assertFalse(ORM::get_config('logging')); + } + + public function testGetConfigArray() { + $expected = array( + 'connection_string' => 'sqlite::memory:', + 'id_column' => 'primary_key', + 'id_column_overrides' => array(), + 'error_mode' => PDO::ERRMODE_EXCEPTION, + 'username' => null, + 'password' => null, + 'driver_options' => null, + 'identifier_quote_character' => '`', + 'logging' => true, + 'caching' => false, + 'return_result_sets' => false, + ); + $this->assertEquals($expected, ORM::get_config()); + } + +}