Page MenuHomeDevCentral

D230.id541.diff
No OneTemporary

D230.id541.diff

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

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)

Event Timeline