diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml
index 628d4cd21..ce949f8ef 100644
--- a/.github/workflows/pull-request.yml
+++ b/.github/workflows/pull-request.yml
@@ -40,7 +40,7 @@ jobs:
- name: php ${{ matrix.php }} 🐘
id: setup-php
- uses: shivammathur/setup-php@2.29.0
+ uses: shivammathur/setup-php@2.30.0
with:
php-version: ${{ matrix.php }}
tools: composer:v2.4.1
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 340b3b89c..d9b7e6385 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -67,7 +67,7 @@ jobs:
- name: php ${{ matrix.php }} 🐘
id: setup-php
- uses: shivammathur/setup-php@2.29.0
+ uses: shivammathur/setup-php@2.30.0
with:
php-version: ${{ matrix.php }}
tools: composer:v2.4.1
@@ -105,7 +105,7 @@ jobs:
- name: php ${{ matrix.php }} 🐘
id: setup-php
- uses: shivammathur/setup-php@2.29.0
+ uses: shivammathur/setup-php@2.30.0
with:
php-version: ${{ matrix.php }}
tools: composer:v2.4.1
diff --git a/.github/workflows/unstable.yml b/.github/workflows/unstable.yml
index 0721806a1..7b8e9ea53 100644
--- a/.github/workflows/unstable.yml
+++ b/.github/workflows/unstable.yml
@@ -37,7 +37,7 @@ jobs:
- name: php ${{ matrix.php }} 🐘
id: setup-php
- uses: shivammathur/setup-php@2.29.0
+ uses: shivammathur/setup-php@2.30.0
with:
php-version: ${{ matrix.php }}
tools: composer:v2.4.1
@@ -107,7 +107,7 @@ jobs:
- name: php ${{ matrix.php }} 🐘
id: setup-php
- uses: shivammathur/setup-php@2.29.0
+ uses: shivammathur/setup-php@2.30.0
with:
php-version: ${{ matrix.php }}
tools: composer:v2.4.1
diff --git a/app/Http/Controllers/CallFlowController.php b/app/Http/Controllers/CallFlowController.php
index 20ca432b9..52b783963 100644
--- a/app/Http/Controllers/CallFlowController.php
+++ b/app/Http/Controllers/CallFlowController.php
@@ -1231,7 +1231,7 @@ private function getResultsString($filtered_list)
}
if ($this->settings->has('include_map_link') && json_decode($this->settings->get('include_map_link'))) {
- array_push($results_string["location_links"], sprintf("https://maps.google.com/maps?q=%s,%s&hl=%s", $filtered_list->latitude, $filtered_list->longitude, $GLOBALS['short_language']));
+ array_push($results_string["location_links"], sprintf("https://maps.google.com/maps?q=%s,%s&hl=%s", $filtered_list->latitude, $filtered_list->longitude, $this->settings->get('short_language')));
}
}
diff --git a/composer.json b/composer.json
index 74218e0c4..912162996 100644
--- a/composer.json
+++ b/composer.json
@@ -7,7 +7,7 @@
"laravel/framework": "^10.39.0",
"laravel/tinker": "^2.8.2",
"phpmailer/phpmailer": "^6.9.1",
- "twilio/sdk": "^6.44.4"
+ "twilio/sdk": "^7.0.0"
},
"require-dev": {
"fakerphp/faker": "^1.23.0",
diff --git a/composer.lock b/composer.lock
index 9de351866..4010dae93 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
- "content-hash": "9d992696fc6c8c7dc78f1c340b4db3da",
+ "content-hash": "9475b6389c4bad3962d76a1e5f0d3c8d",
"packages": [
{
"name": "bmlt-enabled/bmlt-root-server-php-client",
@@ -5882,16 +5882,16 @@
},
{
"name": "twilio/sdk",
- "version": "6.44.4",
+ "version": "7.16.0",
"source": {
"type": "git",
"url": "git@github.com:twilio/twilio-php.git",
- "reference": "08aad5f377e2245b9cd7508e7762d95e7392fa4d"
+ "reference": "b5578d953c8d126b3d13b2440d21c68460035265"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/twilio/twilio-php/zipball/08aad5f377e2245b9cd7508e7762d95e7392fa4d",
- "reference": "08aad5f377e2245b9cd7508e7762d95e7392fa4d",
+ "url": "https://api.github.com/repos/twilio/twilio-php/zipball/b5578d953c8d126b3d13b2440d21c68460035265",
+ "reference": "b5578d953c8d126b3d13b2440d21c68460035265",
"shasum": ""
},
"require": {
@@ -5927,7 +5927,7 @@
"sms",
"twilio"
],
- "time": "2023-02-22T19:59:53+00:00"
+ "time": "2024-02-27T14:19:44+00:00"
},
{
"name": "vlucas/phpdotenv",
diff --git a/docs/package-lock.json b/docs/package-lock.json
index 85dfa1bca..f061e3455 100644
--- a/docs/package-lock.json
+++ b/docs/package-lock.json
@@ -12087,8 +12087,9 @@
}
},
"node_modules/react-player": {
- "version": "2.14.1",
- "license": "MIT",
+ "version": "2.15.1",
+ "resolved": "https://registry.npmjs.org/react-player/-/react-player-2.15.1.tgz",
+ "integrity": "sha512-ni1XFuYZuhIKKdeFII+KRLmIPcvCYlyXvtSMhNOgssdfnSovmakBtBTW2bxowPvmpKy5BTR4jC4CF79ucgHT+g==",
"dependencies": {
"deepmerge": "^4.0.0",
"load-script": "^1.0.0",
diff --git a/package-lock.json b/package-lock.json
index 8979f454e..2d06f87ff 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -2993,9 +2993,9 @@
}
},
"node_modules/@remix-run/router": {
- "version": "1.15.1",
- "resolved": "https://registry.npmjs.org/@remix-run/router/-/router-1.15.1.tgz",
- "integrity": "sha512-zcU0gM3z+3iqj8UX45AmWY810l3oUmXM7uH4dt5xtzvMhRtYVhKGOmgOd1877dOPPepfCjUv57w+syamWIYe7w==",
+ "version": "1.15.3",
+ "resolved": "https://registry.npmjs.org/@remix-run/router/-/router-1.15.3.tgz",
+ "integrity": "sha512-Oy8rmScVrVxWZVOpEF57ovlnhpZ8CCPlnIIumVcV9nFdiSIrus99+Lw78ekXyGvVDlIsFJbSfmSovJUhCWYV3w==",
"engines": {
"node": ">=14.0.0"
}
@@ -12188,9 +12188,9 @@
}
},
"node_modules/plotly.js-dist": {
- "version": "2.29.1",
- "resolved": "https://registry.npmjs.org/plotly.js-dist/-/plotly.js-dist-2.29.1.tgz",
- "integrity": "sha512-jEdUhk9brzzleuJP1vTxk1ECfm896bld78elG6YRPdywyUYAAO0rd+JUNv56hZu4uqUftvKU6xfjSwjm0R3LUw=="
+ "version": "2.30.0",
+ "resolved": "https://registry.npmjs.org/plotly.js-dist/-/plotly.js-dist-2.30.0.tgz",
+ "integrity": "sha512-i/RGYJ6/EyNhvnljxYLnBp/QsfWKrC38yELYE+1j5qWZEO/coh3vIReXhb7vgys6ducv7DMe16onykkfE+UGTw=="
},
"node_modules/plugin-error": {
"version": "1.0.1",
@@ -13143,11 +13143,11 @@
}
},
"node_modules/react-router": {
- "version": "6.22.1",
- "resolved": "https://registry.npmjs.org/react-router/-/react-router-6.22.1.tgz",
- "integrity": "sha512-0pdoRGwLtemnJqn1K0XHUbnKiX0S4X8CgvVVmHGOWmofESj31msHo/1YiqcJWK7Wxfq2a4uvvtS01KAQyWK/CQ==",
+ "version": "6.22.3",
+ "resolved": "https://registry.npmjs.org/react-router/-/react-router-6.22.3.tgz",
+ "integrity": "sha512-dr2eb3Mj5zK2YISHK++foM9w4eBnO23eKnZEDs7c880P6oKbrjz/Svg9+nxqtHQK+oMW4OtjZca0RqPglXxguQ==",
"dependencies": {
- "@remix-run/router": "1.15.1"
+ "@remix-run/router": "1.15.3"
},
"engines": {
"node": ">=14.0.0"
@@ -13157,12 +13157,12 @@
}
},
"node_modules/react-router-dom": {
- "version": "6.22.1",
- "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-6.22.1.tgz",
- "integrity": "sha512-iwMyyyrbL7zkKY7MRjOVRy+TMnS/OPusaFVxM2P11x9dzSzGmLsebkCvYirGq0DWB9K9hOspHYYtDz33gE5Duw==",
+ "version": "6.22.3",
+ "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-6.22.3.tgz",
+ "integrity": "sha512-7ZILI7HjcE+p31oQvwbokjk6OA/bnFxrhJ19n82Ex9Ph8fNAq+Hm/7KchpMGlTgWhUxRHMMCut+vEtNpWpowKw==",
"dependencies": {
- "@remix-run/router": "1.15.1",
- "react-router": "6.22.1"
+ "@remix-run/router": "1.15.3",
+ "react-router": "6.22.3"
},
"engines": {
"node": ">=14.0.0"
diff --git a/resources/views/admin/settings.blade.php b/resources/views/admin/settings.blade.php
index 6862e09dd..3ab5199ab 100644
--- a/resources/views/admin/settings.blade.php
+++ b/resources/views/admin/settings.blade.php
@@ -22,7 +22,7 @@
@if (!$value['hidden'])
{{ $key }}
- @if ($value['description'] != "")
+ @if (!empty($value['description']))
📖
@endif
diff --git a/tests/Feature/MeetingSearchTest.php b/tests/Feature/MeetingSearchTest.php
index 77d302938..68a782009 100644
--- a/tests/Feature/MeetingSearchTest.php
+++ b/tests/Feature/MeetingSearchTest.php
@@ -502,3 +502,382 @@
''
], false);
})->with(['GET', 'POST']);
+
+test('meeting search with valid latitude and longitude with sms summary page', function ($method) {
+ $settingsService = new SettingsService();
+ $settingsService->set('sms_summary_page', true);
+ app()->instance(SettingsService::class, $settingsService);
+ app()->instance(TwilioService::class, $this->twilioService);
+ $this->twilioService->shouldReceive("client")->withArgs([])->andReturn($this->twilioClient);
+ $this->twilioService->shouldReceive("settings")->andReturn($settingsService);
+
+ $timezone = new Timezone('OK', 0, -18000, 'America/New_York', 'Eastern Standard Time');
+ $timezoneService = mock(TimeZoneService::class)->makePartial();
+ $timezoneService->shouldReceive('getTimeZoneForCoordinates')
+ ->withArgs([$this->latitude, $this->longitude])
+ ->once()
+ ->andReturn($timezone);
+ app()->instance(TimeZoneService::class, $timezoneService);
+
+ // mocking TwilioRestClient->messages->create()
+ $messageListMock = mock('\Twilio\Rest\Api\V2010\Account\MessageList');
+ $messageListMock->shouldReceive('create')
+ ->withArgs([$this->from, ["from" => $this->to, "body" => sprintf("Meeting Results, click here: https://localhost/msr/%s/%s", $this->latitude, $this->longitude)]])
+ ->once();
+ $this->twilioClient->messages = $messageListMock;
+
+ $response = $this->call($method, '/meeting-search.php', [
+ 'Latitude' => $this->latitude,
+ 'Longitude' => $this->longitude,
+ 'To' => $this->to,
+ 'From' => $this->from,
+ 'Timestamp' => '2024-02-19 00:00:00'
+ ]);
+ $response
+ ->assertStatus(200)
+ ->assertHeader("Content-Type", "text/xml; charset=UTF-8")
+ ->assertSeeInOrderExact([
+ '',
+ '',
+ 'meeting information found, listing the top 5 results',
+ '',
+ 'number 1',
+ 'Step up and Be Free',
+ '',
+ 'starts at Monday 7:00 PM',
+ '',
+ '128 Main street, Clifton Springs, NY',
+ '',
+ 'number 2',
+ 'A New Way of Life',
+ '',
+ 'starts at Monday 6:30 PM',
+ '',
+ '27 West Genesee Street, Clyde, NY',
+ '',
+ 'number 3',
+ 'Ties That Bind Us Together',
+ '',
+ 'starts at Monday 6:30 PM',
+ '',
+ '99 South St, Auburn, NY',
+ '',
+ 'number 4',
+ 'Courage to Change',
+ '',
+ 'starts at Monday 10:15 AM',
+ '',
+ '12 South Street, Auburn, NY',
+ '',
+ 'number 5',
+ 'Eye of the Hurricane',
+ '',
+ 'starts at Monday 7:30 PM',
+ '',
+ '1008 Main St., East Rochester, NY',
+ '',
+ 'thank you for calling, goodbye',
+ '',
+ ], false);
+})->with(['GET', 'POST']);
+
+test('meeting search with map links', function ($method) {
+ $settingsService = new SettingsService();
+ $settingsService->set('include_map_link', true);
+ app()->instance(SettingsService::class, $settingsService);
+ app()->instance(TwilioService::class, $this->twilioService);
+ $this->twilioService->shouldReceive("client")->withArgs([])->andReturn($this->twilioClient);
+ $this->twilioService->shouldReceive("settings")->andReturn($settingsService);
+
+ $timezone = new Timezone('OK', 0, -18000, 'America/New_York', 'Eastern Standard Time');
+ $timezoneService = mock(TimeZoneService::class)->makePartial();
+ $timezoneService->shouldReceive('getTimeZoneForCoordinates')
+ ->withArgs([$this->latitude, $this->longitude])
+ ->once()
+ ->andReturn($timezone);
+ app()->instance(TimeZoneService::class, $timezoneService);
+
+ // mocking TwilioRestClient->messages->create()
+ $messageListMock = mock('\Twilio\Rest\Api\V2010\Account\MessageList');
+ $messageListMock->shouldReceive('create')
+ ->withArgs([$this->from, ["from" => $this->to, "body" => "Step up and Be Free Monday 7:00 PM, 128 Main street, Clifton Springs, NY https://maps.google.com/maps?q=42.9613734,-77.1205486&hl="]])
+ ->once();
+ $messageListMock->shouldReceive('create')
+ ->withArgs([$this->from, ["from" => $this->to, "body" => "A New Way of Life Monday 6:30 PM, 27 West Genesee Street, Clyde, NY https://maps.google.com/maps?q=43.0851169,-76.872356&hl="]])
+ ->once();
+ $messageListMock->shouldReceive('create')
+ ->withArgs([$this->from, ["from" => $this->to, "body" => "Ties That Bind Us Together Monday 6:30 PM, 99 South St, Auburn, NY https://maps.google.com/maps?q=42.923231,-76.566373&hl="]])
+ ->once();
+ $messageListMock->shouldReceive('create')
+ ->withArgs([$this->from, ["from" => $this->to, "body" => "Courage to Change Monday 10:15 AM, 12 South Street, Auburn, NY https://maps.google.com/maps?q=42.9313221,-76.5656656&hl="]])
+ ->once();
+ $messageListMock->shouldReceive('create')
+ ->withArgs([$this->from, ["from" => $this->to, "body" => "Eye of the Hurricane Monday 7:30 PM, 1008 Main St., East Rochester, NY https://maps.google.com/maps?q=43.1066,-77.487084&hl="]])
+ ->once();
+
+ $this->twilioClient->messages = $messageListMock;
+
+ $response = $this->call($method, '/meeting-search.php', [
+ 'Latitude' => $this->latitude,
+ 'Longitude' => $this->longitude,
+ 'To' => $this->to,
+ 'From' => $this->from,
+ 'Timestamp' => '2024-02-19 00:00:00'
+ ]);
+ $response
+ ->assertStatus(200)
+ ->assertHeader("Content-Type", "text/xml; charset=UTF-8")
+ ->assertSeeInOrderExact([
+ '',
+ '',
+ 'meeting information found, listing the top 5 results',
+ '',
+ 'number 1',
+ 'Step up and Be Free',
+ '',
+ 'starts at Monday 7:00 PM',
+ '',
+ '128 Main street, Clifton Springs, NY',
+ '',
+ 'number 2',
+ 'A New Way of Life',
+ '',
+ 'starts at Monday 6:30 PM',
+ '',
+ '27 West Genesee Street, Clyde, NY',
+ '',
+ 'number 3',
+ 'Ties That Bind Us Together',
+ '',
+ 'starts at Monday 6:30 PM',
+ '',
+ '99 South St, Auburn, NY',
+ '',
+ 'number 4',
+ 'Courage to Change',
+ '',
+ 'starts at Monday 10:15 AM',
+ '',
+ '12 South Street, Auburn, NY',
+ '',
+ 'number 5',
+ 'Eye of the Hurricane',
+ '',
+ 'starts at Monday 7:30 PM',
+ '',
+ '1008 Main St., East Rochester, NY',
+ '',
+ 'thank you for calling, goodbye',
+ '',
+ ], false);
+})->with(['GET', 'POST']);
+
+test('meeting search with location text', function ($method) {
+ $settingsService = new SettingsService();
+ $settingsService->set('include_location_text', true);
+ $settingsService->set('result_count_max', 1);
+ app()->instance(SettingsService::class, $settingsService);
+ app()->instance(TwilioService::class, $this->twilioService);
+ $this->twilioService->shouldReceive("client")->withArgs([])->andReturn($this->twilioClient);
+ $this->twilioService->shouldReceive("settings")->andReturn($settingsService);
+
+ $timezone = new Timezone('OK', 0, -18000, 'America/New_York', 'Eastern Standard Time');
+ $timezoneService = mock(TimeZoneService::class)->makePartial();
+ $timezoneService->shouldReceive('getTimeZoneForCoordinates')
+ ->withArgs([$this->latitude, $this->longitude])
+ ->once()
+ ->andReturn($timezone);
+ app()->instance(TimeZoneService::class, $timezoneService);
+
+ // mocking TwilioRestClient->messages->create()
+ $messageListMock = mock('\Twilio\Rest\Api\V2010\Account\MessageList');
+ $messageListMock->shouldReceive('create')
+ ->withArgs([$this->from, ["from" => $this->to, "body" => "Step up and Be Free Monday 7:00 PM, Clifton springs Hospital, 128 Main street, Clifton Springs, NY"]])
+ ->once();
+
+ $this->twilioClient->messages = $messageListMock;
+
+ $response = $this->call($method, '/meeting-search.php', [
+ 'Latitude' => $this->latitude,
+ 'Longitude' => $this->longitude,
+ 'To' => $this->to,
+ 'From' => $this->from,
+ 'Timestamp' => '2024-02-19 00:00:00'
+ ]);
+ $response
+ ->assertStatus(200)
+ ->assertHeader("Content-Type", "text/xml; charset=UTF-8")
+ ->assertSeeInOrderExact([
+ '',
+ '',
+ 'meeting information found, listing the top 1 results',
+ '',
+ 'number 1',
+ 'Step up and Be Free',
+ '',
+ 'starts at Monday 7:00 PM',
+ '',
+ 'Clifton springs Hospital',
+ '',
+ '128 Main street, Clifton Springs, NY',
+ '',
+ 'thank you for calling, goodbye',
+ '',
+ ], false);
+})->with(['GET', 'POST']);
+
+test('meeting search with distance details in miles', function ($method) {
+ $settingsService = new SettingsService();
+ $settingsService->set('include_distance_details', 'mi');
+ $settingsService->set('result_count_max', 1);
+ app()->instance(SettingsService::class, $settingsService);
+ app()->instance(TwilioService::class, $this->twilioService);
+ $this->twilioService->shouldReceive("client")->withArgs([])->andReturn($this->twilioClient);
+ $this->twilioService->shouldReceive("settings")->andReturn($settingsService);
+
+ $timezone = new Timezone('OK', 0, -18000, 'America/New_York', 'Eastern Standard Time');
+ $timezoneService = mock(TimeZoneService::class)->makePartial();
+ $timezoneService->shouldReceive('getTimeZoneForCoordinates')
+ ->withArgs([$this->latitude, $this->longitude])
+ ->once()
+ ->andReturn($timezone);
+ app()->instance(TimeZoneService::class, $timezoneService);
+
+ // mocking TwilioRestClient->messages->create()
+ $messageListMock = mock('\Twilio\Rest\Api\V2010\Account\MessageList');
+ $messageListMock->shouldReceive('create')
+ ->withArgs([$this->from, ["from" => $this->to, "body" => "Step up and Be Free Monday 7:00 PM, 128 Main street, Clifton Springs, NY (9 mi)"]])
+ ->once();
+
+ $this->twilioClient->messages = $messageListMock;
+
+ $response = $this->call($method, '/meeting-search.php', [
+ 'Latitude' => $this->latitude,
+ 'Longitude' => $this->longitude,
+ 'To' => $this->to,
+ 'From' => $this->from,
+ 'Timestamp' => '2024-02-19 00:00:00'
+ ]);
+ $response
+ ->assertStatus(200)
+ ->assertHeader("Content-Type", "text/xml; charset=UTF-8")
+ ->assertSeeInOrderExact([
+ '',
+ '',
+ 'meeting information found, listing the top 1 results',
+ '',
+ 'number 1',
+ 'Step up and Be Free',
+ '',
+ 'starts at Monday 7:00 PM',
+ '',
+ '128 Main street, Clifton Springs, NY',
+ '',
+ 'thank you for calling, goodbye',
+ '',
+ ], false);
+})->with(['GET', 'POST']);
+
+test('meeting search with distance details in km', function ($method) {
+ $settingsService = new SettingsService();
+ $settingsService->set('include_distance_details', 'km');
+ $settingsService->set('result_count_max', 1);
+ app()->instance(SettingsService::class, $settingsService);
+ app()->instance(TwilioService::class, $this->twilioService);
+ $this->twilioService->shouldReceive("client")->withArgs([])->andReturn($this->twilioClient);
+ $this->twilioService->shouldReceive("settings")->andReturn($settingsService);
+
+ $timezone = new Timezone('OK', 0, -18000, 'America/New_York', 'Eastern Standard Time');
+ $timezoneService = mock(TimeZoneService::class)->makePartial();
+ $timezoneService->shouldReceive('getTimeZoneForCoordinates')
+ ->withArgs([$this->latitude, $this->longitude])
+ ->once()
+ ->andReturn($timezone);
+ app()->instance(TimeZoneService::class, $timezoneService);
+
+ // mocking TwilioRestClient->messages->create()
+ $messageListMock = mock('\Twilio\Rest\Api\V2010\Account\MessageList');
+ $messageListMock->shouldReceive('create')
+ ->withArgs([$this->from, ["from" => $this->to, "body" => "Step up and Be Free Monday 7:00 PM, 128 Main street, Clifton Springs, NY (15 km)"]])
+ ->once();
+
+ $this->twilioClient->messages = $messageListMock;
+ $response = $this->call($method, '/meeting-search.php', [
+ 'Latitude' => $this->latitude,
+ 'Longitude' => $this->longitude,
+ 'To' => $this->to,
+ 'From' => $this->from,
+ 'Timestamp' => '2024-02-19 00:00:00'
+ ]);
+ $response
+ ->assertStatus(200)
+ ->assertHeader("Content-Type", "text/xml; charset=UTF-8")
+ ->assertSeeInOrderExact([
+ '',
+ '',
+ 'meeting information found, listing the top 1 results',
+ '',
+ 'number 1',
+ 'Step up and Be Free',
+ '',
+ 'starts at Monday 7:00 PM',
+ '',
+ '128 Main street, Clifton Springs, NY',
+ '',
+ 'thank you for calling, goodbye',
+ '',
+ ], false);
+})->with(['GET', 'POST']);
+
+test('meeting search with say links', function ($method) {
+ $settingsService = new SettingsService();
+ $settingsService->set('say_links', true);
+ $settingsService->set('include_format_details', ['TC', 'VM', 'HY']);
+ $settingsService->set('result_count_max', 1);
+ app()->instance(SettingsService::class, $settingsService);
+ app()->instance(TwilioService::class, $this->twilioService);
+ $this->twilioService->shouldReceive("client")->withArgs([])->andReturn($this->twilioClient);
+ $this->twilioService->shouldReceive("settings")->andReturn($settingsService);
+
+ $timezone = new Timezone('OK', 0, -18000, 'America/New_York', 'Eastern Standard Time');
+ $timezoneService = mock(TimeZoneService::class)->makePartial();
+ $timezoneService->shouldReceive('getTimeZoneForCoordinates')
+ ->withArgs([$this->latitude, $this->longitude])
+ ->once()
+ ->andReturn($timezone);
+ app()->instance(TimeZoneService::class, $timezoneService);
+
+ // mocking TwilioRestClient->messages->create()
+ $messageListMock = mock('\Twilio\Rest\Api\V2010\Account\MessageList');
+ $messageListMock->shouldReceive('create')
+ ->withArgs([$this->from, ["from" => $this->to, "body" => "Step up and Be Free Monday 7:00 PM, 128 Main street, Clifton Springs, NY"]])
+ ->once();
+
+ $this->twilioClient->messages = $messageListMock;
+ $this->withoutExceptionHandling();
+ $response = $this->call($method, '/meeting-search.php', [
+ 'Latitude' => $this->latitude,
+ 'Longitude' => $this->longitude,
+ 'To' => $this->to,
+ 'From' => $this->from,
+ 'Timestamp' => '2024-02-19 00:00:00'
+ ]);
+ $response
+ ->assertStatus(200)
+ ->assertHeader("Content-Type", "text/xml; charset=UTF-8")
+ ->assertSeeInOrderExact([
+ '',
+ '',
+ 'meeting information found, listing the top 1 results',
+ '',
+ 'number 1',
+ 'Step up and Be Free',
+ '',
+ 'starts at Monday 7:00 PM',
+ '',
+ '128 Main street, Clifton Springs, NY',
+ '',
+ 'thank you for calling, goodbye',
+ '',
+ ], false);
+})->with(['GET', 'POST']);
|