assertInstanceOf('TestApp\Mailer\TestMailer', $stub->getMailer('Test')); static::setAppNamespace($originalAppNamespace); } /** * Test exception thrown by getMailer. */ public function testGetMailerThrowsException() { $this->expectException(\Cake\Mailer\Exception\MissingMailerException::class); $this->expectExceptionMessage('Mailer class "Test" could not be found.'); $stub = new Stub(); $stub->getMailer('Test'); } }