From 2f2feaa4e8ad9a18fd9ddcb7d65ae958c544dbcb Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Tue, 30 Apr 2013 21:38:40 -0500 Subject: [ticket/11413] Don't use the database for the convert test Different databases seem to work slightly differently here and are causing errors PHPBB3-11413 --- tests/notification/convert_test.php | 37 ++++++++++++++++--------------------- 1 file changed, 16 insertions(+), 21 deletions(-) (limited to 'tests/notification') diff --git a/tests/notification/convert_test.php b/tests/notification/convert_test.php index 9fa7fc6a42..529b2935e1 100644 --- a/tests/notification/convert_test.php +++ b/tests/notification/convert_test.php @@ -38,38 +38,33 @@ class phpbb_notification_convert_test extends phpbb_database_test_case public function test_convert() { - $this->migration->convert_notifications(); + $buffer = new phpbb_mock_sql_insert_buffer($this->db, 'phpbb_user_notifications'); + $this->migration->perform_conversion($buffer, 'phpbb_user_notifications'); $expected = array_merge( $this->create_expected('post', 1, 'email'), $this->create_expected('topic', 1, 'email'), - $this->create_expected('pm', 2, 'email'), $this->create_expected('post', 2, 'email'), $this->create_expected('topic', 2, 'email'), + $this->create_expected('pm', 2, 'email'), $this->create_expected('post', 3, 'jabber'), $this->create_expected('topic', 3, 'jabber'), - $this->create_expected('pm', 4, 'jabber'), $this->create_expected('post', 4, 'jabber'), $this->create_expected('topic', 4, 'jabber'), + $this->create_expected('pm', 4, 'jabber'), $this->create_expected('post', 5, 'both'), $this->create_expected('topic', 5, 'both'), - $this->create_expected('pm', 6, 'both'), $this->create_expected('post', 6, 'both'), - $this->create_expected('topic', 6, 'both') + $this->create_expected('topic', 6, 'both'), + $this->create_expected('pm', 6, 'both') ); - $sql = 'SELECT * FROM phpbb_user_notifications - ORDER BY user_id ASC, item_type ASC'; - $result = $this->db->sql_query($sql); - $rowset = $this->db->sql_fetchrowset($result); - $this->db->sql_freeresult($result); - - $this->assertEquals($expected, $rowset); + $this->assertEquals($expected, $buffer->get_buffer()); } protected function create_expected($type, $user_id, $method = '') @@ -80,10 +75,10 @@ class phpbb_notification_convert_test extends phpbb_database_test_case { $return[] = array( 'item_type' => $type, - 'item_id' => '0', - 'user_id' => (string) $user_id, + 'item_id' => 0, + 'user_id' => $user_id, 'method' => '', - 'notify' => '1', + 'notify' => 1, ); } @@ -91,10 +86,10 @@ class phpbb_notification_convert_test extends phpbb_database_test_case { $return[] = array( 'item_type' => $type, - 'item_id' => '0', - 'user_id' => (string) $user_id, + 'item_id' => 0, + 'user_id' => $user_id, 'method' => 'email', - 'notify' => '1', + 'notify' => 1, ); } @@ -102,10 +97,10 @@ class phpbb_notification_convert_test extends phpbb_database_test_case { $return[] = array( 'item_type' => $type, - 'item_id' => '0', - 'user_id' => (string) $user_id, + 'item_id' => 0, + 'user_id' => $user_id, 'method' => 'jabber', - 'notify' => '1', + 'notify' => 1, ); } -- cgit v1.2.1