I've an issue with symfony and phpunit. Our peoject is growing bigger and bigger. So we decided to activate process isolation for phpunit because the server couldn't stand the amount of tests anymore (Not enough RAM). Since then all test which send mails aren't working anymore. Could someone please help us? The test below works perfectly fine if processIsolation="false" but it fails if processIsolation="true"
Versions:
symfony 2.1.8-dev
phpunit 3.7.9
ERROR Message
Project\AppBundle\Tests\MailTest::testSendMail PHPUnit_Framework_Exception: PHP Fatal error: Class 'Swift_Message' not found in /var/www/project/src/Project/AppBundle/Tests/MailTest.php
Test
public function testSendMail()
{
$client = static::createClient();
$message = \Swift_Message::newInstance();
$message->setFrom('example@example.com')
->setTo('example@example.com')
->setSubject('Subject')
->setBody('Hello World')
->setContentType('text/html');
$client->getContainer()->get('mailer')->send($message);
$this->assertTrue(true);
}
phpunit.xml
<phpunit
backupGlobals="false"
backupStaticAttributes="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
bootstrap="./autoload.php"
processIsolation="true"
stopOnFailure="false"
syntaxCheck="false" >
<testsuites>
<testsuite name="Project Test Suite">
<directory>../src/Project/AppBundle/Tests/MailTest.php</directory>
</testsuite>
</testsuites>
</phpunit>