summaryrefslogtreecommitdiff
path: root/vendor/j4mie/idiorm/test/ConfigTest53.php
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/j4mie/idiorm/test/ConfigTest53.php')
-rw-r--r--vendor/j4mie/idiorm/test/ConfigTest53.php36
1 files changed, 36 insertions, 0 deletions
diff --git a/vendor/j4mie/idiorm/test/ConfigTest53.php b/vendor/j4mie/idiorm/test/ConfigTest53.php
new file mode 100644
index 000000000..ef8af778a
--- /dev/null
+++ b/vendor/j4mie/idiorm/test/ConfigTest53.php
@@ -0,0 +1,36 @@
+<?php
+
+class ConfigTest53 extends PHPUnit_Framework_TestCase {
+
+ public function setUp() {
+ // Enable logging
+ ORM::configure('logging', true);
+
+ // Set up the dummy database connection
+ $db = new MockPDO('sqlite::memory:');
+ ORM::set_db($db);
+
+ ORM::configure('id_column', 'primary_key');
+ }
+
+ public function tearDown() {
+ ORM::configure('logging', false);
+ ORM::set_db(null);
+
+ ORM::configure('id_column', 'id');
+ }
+
+ public function testLoggerCallback() {
+ ORM::configure('logger', function($log_string) {
+ return $log_string;
+ });
+ $function = ORM::get_config('logger');
+ $this->assertTrue(is_callable($function));
+
+ $log_string = "UPDATE `widget` SET `added` = NOW() WHERE `id` = '1'";
+ $this->assertEquals($log_string, $function($log_string));
+
+ ORM::configure('logger', null);
+ }
+
+} \ No newline at end of file