Skip to content

Commit

Permalink
Merge pull request #626 from cakephp/mailer
Browse files Browse the repository at this point in the history
Remove creation of empty email layouts by mailer command.
  • Loading branch information
markstory authored Dec 25, 2019
2 parents 546a27d + c5ed0bd commit 219978f
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 24 deletions.
20 changes: 0 additions & 20 deletions src/Command/MailerCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

use Cake\Console\Arguments;
use Cake\Console\ConsoleIo;
use Cake\Utility\Inflector;

/**
* Mailer code generator.
Expand Down Expand Up @@ -66,25 +65,6 @@ public function template(): string
*/
public function bake(string $name, Arguments $args, ConsoleIo $io): void
{
$this->bakeLayouts($name, $args, $io);

parent::bake($name, $args, $io);
}

/**
* Bake empty layout files for html/text emails.
*
* @param string $name The name of the mailer layouts are needed for.
* @param \Cake\Console\Arguments $args The console arguments
* @param \Cake\Console\ConsoleIo $io The console io
* @return void
*/
protected function bakeLayouts(string $name, Arguments $args, ConsoleIo $io): void
{
foreach (['html', 'text'] as $type) {
$pathFragment = implode(DS, ['layout', 'email', $type, Inflector::underscore($name) . '.php']);
$path = $this->getTemplatePath($args) . $pathFragment;
$io->createFile($path, '');
}
}
}
4 changes: 0 additions & 4 deletions tests/TestCase/Command/MailerCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@ public function testMain()
$this->generatedFiles = [
APP . 'Mailer/ExampleMailer.php',
ROOT . 'tests/TestCase/Mailer/ExampleMailerTest.php',
ROOT . 'templates/layout/email/html/example.php',
ROOT . 'templates/layout/email/text/example.php',
];
$this->exec('bake mailer Example');

Expand All @@ -72,8 +70,6 @@ public function testMainPlugin()
$this->generatedFiles = [
$path . 'src/Mailer/ExampleMailer.php',
$path . 'tests/TestCase/Mailer/ExampleMailerTest.php',
$templatePath . 'layout/email/html/example.php',
$templatePath . 'layout/email/text/example.php',
];
$this->exec('bake mailer TestBake.Example');

Expand Down

0 comments on commit 219978f

Please sign in to comment.