Skip to content

Commit

Permalink
Change route names to be less colliding.
Browse files Browse the repository at this point in the history
  • Loading branch information
jstoone committed Nov 24, 2018
1 parent 531a6c3 commit 4c277bc
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
9 changes: 6 additions & 3 deletions routes/api.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
|
*/

// TODO: Add prefix to route name
Route::resource('mail', \Jstoone\Mailman\Http\Controllers\MailmanController::class)
->only(['index', 'show']);
Route::apiResource('mail', \Jstoone\Mailman\Http\Controllers\MailmanController::class)
->only(['index', 'show'])
->names([
'index' => 'nova-mailman.index',
'show' => 'nova-mailman.show',
]);
2 changes: 1 addition & 1 deletion src/Mailer/MailmanTransport.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ protected function getMailMetadata(Swift_Mime_SimpleMessage $message): string
'recipient' => array_first(array_keys($message->getTo())),
'subject' => $message->getSubject(),
'sent_at' => time(),
'link' => route('mail.show', $this->identifier),
'link' => route('nova-mailman.show', $this->identifier),
], JSON_PRETTY_PRINT);
}
}
8 changes: 4 additions & 4 deletions tests/Http/Controllers/MailmanControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,23 @@ public function it_returns_emails()
);

$this->withoutExceptionHandling();
$response = $this->get(route('mail.index'))
$response = $this->get(route('nova-mailman.index'))
->assertSuccessful()
->assertJson([
[
'id' => 'unique-mail-identifier',
'recipient' => $recipient,
'subject' => $subject,
'sent_at' => time(),
'link' => route('mail.show', 'unique-mail-identifier'),
'link' => route('nova-mailman.show', 'unique-mail-identifier'),
],
]);
}

/** @test */
public function it_gives_empty_response_upon_missing_directory()
{
$this->get(route('mail.index'))
$this->get(route('nova-mailman.index'))
->assertSuccessful()
->assertJson([]);
}
Expand All @@ -54,7 +54,7 @@ public function it_can_return_the_view_for_a_given_mail()
$recipient = '[email protected]'
);

$this->get(route('mail.show', 'unique-mail-identifier'))
$this->get(route('nova-mailman.show', 'unique-mail-identifier'))
->assertSuccessful()
->assertViewIs('nova-mailman-mails::unique-mail-identifier');
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Mailer/MailmanTransportTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function it_stores_email_metadata_in_a_json_file()
'subject' => $message->getSubject(),
'recipient' => '[email protected]',
'sent_at' => time(),
'link' => route('mail.show', 'unique-identifier'),
'link' => route('nova-mailman.show', 'unique-identifier'),
],
json_decode($file, true)
);
Expand Down

0 comments on commit 4c277bc

Please sign in to comment.