Find this useful? Enter your email to receive occasional updates for securing PHP code.
Signing you up...
Thank you for signing up!
PHP Decode
<?php namespace Illuminate\Tests\Integration\Notifications; use Illuminate\Notifications..
Decoded Output download
<?php
namespace Illuminate\Tests\Integration\Notifications;
use Illuminate\Notifications\AnonymousNotifiable;
use Illuminate\Notifications\Notification;
use Illuminate\Support\Facades\Notification as NotificationFacade;
use Illuminate\Support\Testing\Fakes\NotificationFake;
use Orchestra\Testbench\TestCase;
class SendingNotificationsViaAnonymousNotifiableTest extends TestCase
{
public function testMailIsSent()
{
$notifiable = (new AnonymousNotifiable)
->route('testchannel', 'enzo')
->route('anothertestchannel', '[email protected]');
NotificationFacade::send(
$notifiable,
new TestMailNotificationForAnonymousNotifiable
);
$this->assertEquals([
'enzo', '[email protected]',
], $_SERVER['__notifiable.route']);
}
public function testAnonymousNotifiableWithMultipleRoutes()
{
$_SERVER['__notifiable.route'] = [];
NotificationFacade::routes([
'testchannel' => 'enzo',
'anothertestchannel' => '[email protected]',
])->notify(new TestMailNotificationForAnonymousNotifiable());
$this->assertEquals([
'enzo', '[email protected]',
], $_SERVER['__notifiable.route']);
}
public function testFaking()
{
$fake = NotificationFacade::fake();
$this->assertInstanceOf(NotificationFake::class, $fake);
$notifiable = (new AnonymousNotifiable)
->route('testchannel', 'enzo')
->route('anothertestchannel', '[email protected]');
NotificationFacade::locale('it')->send(
$notifiable,
new TestMailNotificationForAnonymousNotifiable
);
NotificationFacade::assertSentTo(new AnonymousNotifiable, TestMailNotificationForAnonymousNotifiable::class,
function ($notification, $channels, $notifiable, $locale) {
return $notifiable->routes['testchannel'] === 'enzo' &&
$notifiable->routes['anothertestchannel'] === '[email protected]' &&
$locale === 'it';
}
);
}
}
class TestMailNotificationForAnonymousNotifiable extends Notification
{
public function via($notifiable)
{
return [TestCustomChannel::class, AnotherTestCustomChannel::class];
}
}
class TestCustomChannel
{
public function send($notifiable, $notification)
{
$_SERVER['__notifiable.route'][] = $notifiable->routeNotificationFor('testchannel');
}
}
class AnotherTestCustomChannel
{
public function send($notifiable, $notification)
{
$_SERVER['__notifiable.route'][] = $notifiable->routeNotificationFor('anothertestchannel');
}
}
?>
Did this file decode correctly?
Original Code
<?php
namespace Illuminate\Tests\Integration\Notifications;
use Illuminate\Notifications\AnonymousNotifiable;
use Illuminate\Notifications\Notification;
use Illuminate\Support\Facades\Notification as NotificationFacade;
use Illuminate\Support\Testing\Fakes\NotificationFake;
use Orchestra\Testbench\TestCase;
class SendingNotificationsViaAnonymousNotifiableTest extends TestCase
{
public function testMailIsSent()
{
$notifiable = (new AnonymousNotifiable)
->route('testchannel', 'enzo')
->route('anothertestchannel', '[email protected]');
NotificationFacade::send(
$notifiable,
new TestMailNotificationForAnonymousNotifiable
);
$this->assertEquals([
'enzo', '[email protected]',
], $_SERVER['__notifiable.route']);
}
public function testAnonymousNotifiableWithMultipleRoutes()
{
$_SERVER['__notifiable.route'] = [];
NotificationFacade::routes([
'testchannel' => 'enzo',
'anothertestchannel' => '[email protected]',
])->notify(new TestMailNotificationForAnonymousNotifiable());
$this->assertEquals([
'enzo', '[email protected]',
], $_SERVER['__notifiable.route']);
}
public function testFaking()
{
$fake = NotificationFacade::fake();
$this->assertInstanceOf(NotificationFake::class, $fake);
$notifiable = (new AnonymousNotifiable)
->route('testchannel', 'enzo')
->route('anothertestchannel', '[email protected]');
NotificationFacade::locale('it')->send(
$notifiable,
new TestMailNotificationForAnonymousNotifiable
);
NotificationFacade::assertSentTo(new AnonymousNotifiable, TestMailNotificationForAnonymousNotifiable::class,
function ($notification, $channels, $notifiable, $locale) {
return $notifiable->routes['testchannel'] === 'enzo' &&
$notifiable->routes['anothertestchannel'] === '[email protected]' &&
$locale === 'it';
}
);
}
}
class TestMailNotificationForAnonymousNotifiable extends Notification
{
public function via($notifiable)
{
return [TestCustomChannel::class, AnotherTestCustomChannel::class];
}
}
class TestCustomChannel
{
public function send($notifiable, $notification)
{
$_SERVER['__notifiable.route'][] = $notifiable->routeNotificationFor('testchannel');
}
}
class AnotherTestCustomChannel
{
public function send($notifiable, $notification)
{
$_SERVER['__notifiable.route'][] = $notifiable->routeNotificationFor('anothertestchannel');
}
}
Function Calls
None |
Stats
MD5 | c5dedefa51fe648a8d892e3ce71944c6 |
Eval Count | 0 |
Decode Time | 126 ms |