Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 1 addition & 35 deletions src/Illuminate/Notifications/AnonymousNotifiable.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,10 @@

namespace Illuminate\Notifications;

use BadMethodCallException;
use Illuminate\Contracts\Notifications\Dispatcher;
use Illuminate\Contracts\Support\Arrayable;
use Illuminate\Support\Fluent;
use InvalidArgumentException;

class AnonymousNotifiable extends Fluent
class AnonymousNotifiable
{
/**
* All of the notification routing information.
Expand Down Expand Up @@ -37,23 +34,6 @@ public function route($channel, $route)
return $this;
}

/**
* Add dynamic properties to the instance.
*
* @param \Illuminate\Contracts\Support\Arrayable|array $attributes
* @return $this
*/
public function with($attributes)
{
if ($attributes instanceof Arrayable) {
$attributes = $attributes->toArray();
}

$this->attributes = array_merge($this->attributes, $attributes);

return $this;
}

/**
* Send the given notification.
*
Expand Down Expand Up @@ -96,18 +76,4 @@ public function getKey()
{
//
}

/**
* Disable dynamic calls to set a parameter value.
*
* @param string $method
* @param array $parameters
* @return void
*/
public function __call($method, $parameters)
{
throw new BadMethodCallException(sprintf(
'Call to undefined method %s::%s()', static::class, $method
));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Illuminate\Tests\Integration\Notifications;

use BadMethodCallException;
use Illuminate\Notifications\AnonymousNotifiable;
use Illuminate\Notifications\Notification;
use Illuminate\Support\Facades\Notification as NotificationFacade;
Expand Down Expand Up @@ -37,22 +36,6 @@ public function testMailIsSent()
], $_SERVER['__notifiable.route']);
}

public function testAnonymousNotifiableWithProperties()
{
NotificationFacade::route('testchannel', 'enzo')
->with(['foo' => 'bar'])
->notify(new AnonymousTestNotificationWithProperties($this));
}

public function testAnonymouseNotifiableDoesntAllowSetCalls()
{
$this->expectException(BadMethodCallException::class);
$this->expectExceptionMessage('Call to undefined method Illuminate\Notifications\AnonymousNotifiable::foo()');

NotificationFacade::route('testchannel', 'enzo')
->foo('bar');
}

public function testFaking()
{
$fake = NotificationFacade::fake();
Expand Down Expand Up @@ -101,18 +84,3 @@ public function send($notifiable, $notification)
$_SERVER['__notifiable.route'][] = $notifiable->routeNotificationFor('anothertestchannel');
}
}

class AnonymousTestNotificationWithProperties extends Notification
{
public function __construct($test)
{
$this->test = $test;
}

public function via($notifiable)
{
$this->test->assertSame('bar', $notifiable->foo);

return [TestCustomChannel::class];
}
}