@@ -1828,4 +1828,77 @@ public function testSharedLocations()
18281828 $ this ->assertEquals (-118.2437 , $ newUserLocations ["active_live_locations " ][0 ]["longitude " ]);
18291829 $ this ->assertEquals ('test-device-123 ' , $ newUserLocations ["active_live_locations " ][0 ]["created_by_device_id " ]);
18301830 }
1831+
1832+ /**
1833+ * Test backwards compatibility for reminders -> message_re_engagement_hooks
1834+ * Changes:
1835+ * - app_config.reminders_interval -> message_re_engagement_hooks_interval
1836+ * - channel_config.reminders -> message_re_engagement_hooks
1837+ */
1838+ public function testBackwardsCompatibilityMessageReEngagementHooksIntervalIncludedInAppSettings ()
1839+ {
1840+ $ response = $ this ->client ->getAppSettings ();
1841+
1842+ $ this ->assertArrayHasKey ('app ' , $ response );
1843+ $ this ->assertArrayHasKey ('message_re_engagement_hooks_interval ' , $ response ['app ' ]);
1844+ $ this ->assertArrayHasKey ('reminders_interval ' , $ response ['app ' ]);
1845+ }
1846+
1847+ public function testBackwardsCompatibilityMessageReEngagementHooksIntervalCanBeChangedServerSide ()
1848+ {
1849+ $ this ->client ->updateAppSettings (['message_re_engagement_hooks_interval ' => 68 ]);
1850+ $ response = $ this ->client ->getAppSettings ();
1851+
1852+ $ this ->assertEquals (68 , $ response ['app ' ]['message_re_engagement_hooks_interval ' ]);
1853+ $ this ->assertEquals (68 , $ response ['app ' ]['reminders_interval ' ]);
1854+ }
1855+
1856+ public function testBackwardsCompatibilityCanBeEnabledForChannelType ()
1857+ {
1858+ $ response = $ this ->client ->updateChannelType ('messaging ' , [
1859+ 'message_re_engagement_hooks ' => true ,
1860+ ]);
1861+
1862+ $ this ->assertTrue ($ response ['message_re_engagement_hooks ' ]);
1863+ $ this ->assertTrue ($ response ['reminders ' ]);
1864+ }
1865+
1866+ public function testBackwardsCompatibilityCanBeDisabledForChannelType ()
1867+ {
1868+ $ response = $ this ->client ->updateChannelType ('messaging ' , [
1869+ 'message_re_engagement_hooks ' => false ,
1870+ ]);
1871+
1872+ $ this ->assertFalse ($ response ['message_re_engagement_hooks ' ]);
1873+ $ this ->assertFalse ($ response ['reminders ' ]);
1874+ }
1875+
1876+ public function testBackwardsCompatibilityOldRemindersIntervalStillWorks ()
1877+ {
1878+ $ this ->client ->updateAppSettings (['reminders_interval ' => 45 ]);
1879+ $ response = $ this ->client ->getAppSettings ();
1880+
1881+ $ this ->assertEquals (45 , $ response ['app ' ]['message_re_engagement_hooks_interval ' ]);
1882+ $ this ->assertEquals (45 , $ response ['app ' ]['reminders_interval ' ]);
1883+ }
1884+
1885+ public function testBackwardsCompatibilityOldRemindersAttributeCanEnableChannelType ()
1886+ {
1887+ $ response = $ this ->client ->updateChannelType ('messaging ' , [
1888+ 'reminders ' => true ,
1889+ ]);
1890+
1891+ $ this ->assertTrue ($ response ['message_re_engagement_hooks ' ]);
1892+ $ this ->assertTrue ($ response ['reminders ' ]);
1893+ }
1894+
1895+ public function testBackwardsCompatibilityOldRemindersAttributeCanDisableChannelType ()
1896+ {
1897+ $ response = $ this ->client ->updateChannelType ('messaging ' , [
1898+ 'reminders ' => false ,
1899+ ]);
1900+
1901+ $ this ->assertFalse ($ response ['message_re_engagement_hooks ' ]);
1902+ $ this ->assertFalse ($ response ['reminders ' ]);
1903+ }
18311904}
0 commit comments