Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
freekmurze committed Jan 13, 2022
1 parent ecfe7a7 commit 901f459
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/RayServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,12 @@ protected function registerSettings(): self

public function setProjectName(): self
{
if (Ray::$projectName !== '') {
ray()->project(config('app.name'));
if (Ray::$projectName === '') {
$projectName = config('app.name');

if ($projectName !== 'Laravel') {
ray()->project($projectName);
}
}

return $this;
Expand Down
16 changes: 16 additions & 0 deletions tests/RayTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

use Illuminate\Support\Arr;
use Illuminate\Support\Facades\Log;
use Spatie\LaravelRay\Ray;
use Spatie\LaravelRay\RayServiceProvider;
use Spatie\LaravelRay\Tests\Concerns\MatchesOsSafeSnapshots;
use Spatie\LaravelRay\Tests\TestClasses\TestMailable;
use Spatie\LaravelRay\Tests\TestClasses\User;
Expand Down Expand Up @@ -177,4 +179,18 @@ public function it_sends_a_filtered_environment_payload()
$this->assertEquals('ray_test', $payloads[0]['payloads'][0]['content']['values']['DB_DATABASE']);
$this->assertCount(2, $payloads[0]['payloads'][0]['content']['values']);
}

/** @test */
public function the_project_name_will_automatically_be_set_if_it_something_other_than_laravel()
{
(new RayServiceProvider($this->app))->setProjectName();

$this->assertEquals('', Ray::$projectName);

config()->set('app.name', 'my-project');

(new RayServiceProvider($this->app))->setProjectName();

$this->assertEquals('my-project', Ray::$projectName);
}
}

0 comments on commit 901f459

Please sign in to comment.