Page MenuHomeDevCentral

D230.diff
No OneTemporary

D230.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, 19:57 (18 h, 5 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2249776
Default Alt Text
D230.diff (1 KB)

Event Timeline