Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F3750175
D230.id541.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D230.id541.diff
View Options
diff --git a/app/Providers/ServicesServiceProvider.php b/app/Providers/ServicesServiceProvider.php
--- a/app/Providers/ServicesServiceProvider.php
+++ b/app/Providers/ServicesServiceProvider.php
@@ -16,7 +16,7 @@
public function register() {
$this->app->singleton('services', function (Application $app) {
$path = config('services.gate.credentials');
- if ($app->make('filesystem')->has($path)) {
+ if (strlen($path) > 0 && $app->make('filesystem')->has($path)) {
return Services::loadFromJson($path);
}
diff --git a/tests/Providers/ServicesServiceProviderTest.php b/tests/Providers/ServicesServiceProviderTest.php
new file mode 100644
--- /dev/null
+++ b/tests/Providers/ServicesServiceProviderTest.php
@@ -0,0 +1,41 @@
+<?php
+
+namespace Nasqueron\Notifications\Tests\Providers;
+
+use Nasqueron\Notifications\Providers\ServicesServiceProvider;
+
+use Config;
+
+class ServicesServiceProviderTest extends TestCase {
+
+ public function testType () {
+ $this->assertServiceInstanceOf(
+ 'Nasqueron\Notifications\Services\Services',
+ 'services'
+ );
+ }
+
+ ///
+ /// Tests specific to this service provider
+ ///
+
+ public function testWithCredentialsFile () {
+ $services = $this->app->make('services');
+
+ $this->assertGreaterThan(0, count($services->services));
+ }
+
+ public function testWithoutCredentialsFile () {
+ Config::set('services.gate.credentials', null);
+ $services = $this->app->make('services');
+
+ $this->assertEquals(0, count($services->services));
+ }
+
+ public function testWithNontFoundCredentialsFile () {
+ Config::set('services.gate.credentials', 'notfound.json');
+ $services = $this->app->make('services');
+
+ $this->assertEquals(0, count($services->services));
+ }
+}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Nov 17, 21:55 (19 h, 59 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2249776
Default Alt Text
D230.id541.diff (1 KB)
Attached To
Mode
D230: Fixed issue when credentials.json is not defined in the config
Attached
Detach File
Event Timeline
Log In to Comment