tests working with emails alsog

This commit is contained in:
2025-11-10 23:51:18 -08:00
parent a659368867
commit f26aa9cbd3
11 changed files with 240 additions and 24 deletions

View File

@@ -7,6 +7,9 @@ use Cake\Core\Configure;
use Cake\Core\Plugin;
use Cake\Database\Connection;
use Cake\Datasource\ConnectionManager;
use Cake\Mailer\Mailer;
use Cake\Mailer\Transport\DebugTransport;
use Cake\Mailer\TransportFactory;
use Cake\TestSuite\Fixture\SchemaLoader;
use CakeContactUs\CakeContactUsPlugin;
use Migrations\TestSuite\Migrator;
@@ -66,7 +69,34 @@ Configure::write('ContactUs', [
],
],
]);
Configure::write('EmailTransport', [
'default' => [
'className' => DebugTransport::class,
]
]);
TransportFactory::setConfig('default', [
'className' => DebugTransport::class,
]);
Configure::write('Email', [
/*
* Email delivery profiles
*
* Delivery profiles allow you to predefine various properties about email
* messages from your application and give the settings a name. This saves
* duplication across your application and makes maintenance and development
* easier. Each profile accepts a number of keys. See `Cake\Mailer\Email`
* for more information.
*/
'default' => [
'transport' => 'default',
'from' => 'test@example.com',
/*
* Will by default be set to config value of App.encoding, if that exists otherwise to UTF-8.
*/
//'charset' => 'utf-8',
//'headerCharset' => 'utf-8',
],
]);
$cache = [
'default' => [
'engine' => 'File',
@@ -89,6 +119,7 @@ $cache = [
];
Cache::setConfig($cache);
Mailer::setConfig(Configure::consume('Email'));
class_alias(AppController::class, 'App\Controller\AppController');