Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
freekmurze committed Jan 30, 2017
1 parent 9df6685 commit e48bec9
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 25 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Expand Up @@ -2,6 +2,11 @@

All notable changes to `laravel-mailable-test` will be documented in this file

## 1.0.1 - 2017-01-30

- fix naming of config file
- fix binding issues

## 1.0.0 - 2017-01-30

- initial release
File renamed without changes.
2 changes: 1 addition & 1 deletion src/MailableFactory.php
Expand Up @@ -12,7 +12,7 @@ class MailableFactory
/** @var \Spatie\MailableTest\FakerArgumentValueProvider */
protected $argumentValueProvider;

public function __construct(FakerArgumentValueProvider $argumentValueProvider)
public function __construct(ArgumentValueProvider $argumentValueProvider)
{
$this->argumentValueProvider = $argumentValueProvider;
}
Expand Down
32 changes: 8 additions & 24 deletions src/MailableTestServiceProvider.php
Expand Up @@ -10,40 +10,24 @@ class MailableTestServiceProvider extends ServiceProvider
public function boot()
{
$this->publishes([
__DIR__.'/config/laravel-mailable-test.php' => config_path('laravel-mailable-test.php'),
__DIR__.'/config/mailable-test.php' => config_path('mailable-test.php'),
], 'config');
}

public function register()
{
$this->mergeConfigFrom(__DIR__.'/../config/laravel-mailable-test.php', 'laravel-mailable-test');
$this->mergeConfigFrom(__DIR__.'/../config/mailable-test.php', 'mailable-test');

$this->registerArgumentValueProvider();
$this->registerMailableFactory();

$this->commands([
SendTestMail::class,
]);
}

protected function registerArgumentValueProvider()
{
$this->app->singleton(ArgumentValueProvider::class, function () {
return new FakerArgumentValueProvider(
$this->app->bind(ArgumentValueProvider::class, function () {
$argumentValueProvider = config('mailable-test.argument_value_provider_class');
return new $argumentValueProvider(
Faker::create()
);
});
}

protected function registerMailableFactory()
{
$this->app->singleton(MailableFactory::class, function () {
$argumentValueProvider = app(
config('laravel-mailable-test.argument_value_provider_class')
);

return new MailableFactory($argumentValueProvider);
});
$this->commands([
SendTestMail::class,
]);
}

public function provides(): array
Expand Down

0 comments on commit e48bec9

Please sign in to comment.