Skip to content

Commit

Permalink
fix phpstan issues
Browse files Browse the repository at this point in the history
  • Loading branch information
emmachughes committed Jan 23, 2025
1 parent 755416e commit 06d3616
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion sourcecode/hub/app/Console/Commands/AddLtiToolExtra.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use App\Models\LtiToolExtra;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;
use function is_string;

class AddLtiToolExtra extends Command
{
Expand All @@ -27,11 +28,14 @@ public function handle(): void
->firstOrFail();

DB::transaction(function () use ($tool) {
$slug = $this->option('slug');
$extra = new LtiToolExtra();
$extra->name = $this->argument('name');
$extra->lti_launch_url = $this->argument('url');
$extra->admin = $this->option('admin');
$extra->slug = $this->option('slug');
if (is_string($slug)) {
$extra->slug = $slug;
}
$extra->lti_tool_id = $tool->id;
$extra->save();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public function testAddsLtiTool(): void
$extra = LtiToolExtra::where('slug', 'ca-admin')->firstOrFail();
assert($extra instanceof LtiToolExtra);

$this->assertTrue($extra->tool->is($tool));
$this->assertTrue($extra->tool?->is($tool));
$this->assertSame('CA admin', $extra->name);
$this->assertSame('https://ca.edlib.test/lti/admin', $extra->lti_launch_url);
$this->assertSame('ca-admin', $extra->slug);
Expand Down

0 comments on commit 06d3616

Please sign in to comment.