Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
39 / 39 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
| phpbb_migrations_remove_jabber_migration_test | |
100.00% |
39 / 39 |
|
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
| test_remove_jabber_migration | |
100.00% |
39 / 39 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | /** |
| 3 | * |
| 4 | * This file is part of the phpBB Forum Software package. |
| 5 | * |
| 6 | * @copyright (c) phpBB Limited <https://www.phpbb.com> |
| 7 | * @license GNU General Public License, version 2 (GPL-2.0) |
| 8 | * |
| 9 | * For full copyright and license information, please see |
| 10 | * the docs/CREDITS.txt file. |
| 11 | * |
| 12 | */ |
| 13 | |
| 14 | require_once __DIR__ . '/migration_test_base.php'; |
| 15 | |
| 16 | class phpbb_migrations_remove_jabber_migration_test extends phpbb_migration_test_base |
| 17 | { |
| 18 | |
| 19 | protected $migration_class = '\phpbb\db\migration\data\v400\remove_jabber'; |
| 20 | protected $fixture = '/fixtures/migration_remove_jabber.xml'; |
| 21 | |
| 22 | public function test_remove_jabber_migration() |
| 23 | { |
| 24 | $sql = "SELECT id FROM phpbb_user_notifications |
| 25 | WHERE method = 'notification.method.jabber'"; |
| 26 | $result = $this->db->sql_query($sql); |
| 27 | $rowset = $this->db->sql_fetchrowset($result); |
| 28 | $this->db->sql_freeresult($result); |
| 29 | $this->assertEquals(14, count($rowset)); |
| 30 | |
| 31 | $sql = "SELECT config_name FROM phpbb_config |
| 32 | WHERE config_name = 'jab_enable'"; |
| 33 | $this->assertNotFalse($this->db->sql_query($sql)); |
| 34 | |
| 35 | $this->assertTrue($this->tools['permission']->exists('a_jabber')); |
| 36 | $this->assertTrue($this->tools['permission']->exists('u_sendim')); |
| 37 | $this->assertTrue($this->tools['module']->exists('acp', 'ACP_CLIENT_COMMUNICATION', 'ACP_JABBER_SETTINGS')); |
| 38 | |
| 39 | $this->apply_migration(); |
| 40 | |
| 41 | $sql = "SELECT id FROM phpbb_user_notifications |
| 42 | WHERE method = 'notification.method.jabber'"; |
| 43 | $this->db->sql_query($sql); |
| 44 | $this->assertFalse($this->db->sql_fetchfield('id')); |
| 45 | |
| 46 | $sql = "SELECT id FROM phpbb_user_notifications |
| 47 | WHERE method = 'notification.method.jabber'"; |
| 48 | $result = $this->db->sql_query($sql); |
| 49 | $rowset = $this->db->sql_fetchrowset($result); |
| 50 | $this->db->sql_freeresult($result); |
| 51 | $this->assertEquals(0, count($rowset)); |
| 52 | |
| 53 | $sql = "SELECT config_name FROM phpbb_config |
| 54 | WHERE config_name = 'jab_enable'"; |
| 55 | $this->db->sql_query($sql); |
| 56 | $this->assertFalse($this->db->sql_fetchfield('config_name')); |
| 57 | |
| 58 | $this->assertFalse($this->tools['permission']->exists('a_jabber')); |
| 59 | $this->assertFalse($this->tools['permission']->exists('u_sendim')); |
| 60 | $this->assertFalse($this->tools['module']->exists('acp', 'ACP_CLIENT_COMMUNICATION', 'ACP_JABBER_SETTINGS')); |
| 61 | |
| 62 | $this->revert_migration(); |
| 63 | |
| 64 | $sql = "SELECT config_name FROM phpbb_config |
| 65 | WHERE config_name = 'jab_enable'"; |
| 66 | $this->db->sql_query($sql); |
| 67 | $this->assertEquals('jab_enable', $this->db->sql_fetchfield('config_name')); |
| 68 | |
| 69 | $this->assertTrue($this->tools['permission']->exists('a_jabber')); |
| 70 | $this->assertTrue($this->tools['permission']->exists('u_sendim')); |
| 71 | $this->assertTrue($this->tools['module']->exists('acp', 'ACP_CLIENT_COMMUNICATION', 'ACP_JABBER_SETTINGS')); |
| 72 | |
| 73 | // Apply migration back |
| 74 | $this->apply_migration(); |
| 75 | } |
| 76 | } |