Symfony2 swiftmailer功能测试在Gitlab CI上不起作用
我使用Symfony2(.7)和swiftmailer发送电子邮件。按照symfony页面的建议,使用profiler创建了一个功能,可以同时向多个用户发送电子邮件,并对其进行了功能测试。测试由PHPUnit运行Symfony2 swiftmailer功能测试在Gitlab CI上不起作用,symfony,phpunit,gitlab,swiftmailer,gitlab-ci,Symfony,Phpunit,Gitlab,Swiftmailer,Gitlab Ci,我使用Symfony2(.7)和swiftmailer发送电子邮件。按照symfony页面的建议,使用profiler创建了一个功能,可以同时向多个用户发送电子邮件,并对其进行了功能测试。测试由PHPUnit运行 $client->enableProfiler(); $crawler = $client->request(...); if ($profile = $client->getProfile()) { $this->assertEquals(1,
$client->enableProfiler();
$crawler = $client->request(...);
if ($profile = $client->getProfile()) {
$this->assertEquals(1, $mailCollector->getMessageCount());
}
问题是,在我的本地pc(windows)上测试正常,但在GitLab Community Edition 8.8.1的CI上运行时,测试失败。$mailCollector->getMessageCount()返回0,并且$mailCollector->getMessages()返回空数组
CI配置:
before_script:
- composer config --global ..
- composer self-update
- composer install
- cat app/config/parameters.yml
- mysqlthings
stages:
- test
test:
script:
- php app/console doctrine:schema:update --force
- php app/console doctrine:fixtures:load
- php app/console security:check
- php app/console cache:clear --env=test
- php -d zend_extension=xdebug.so phpunit.phar -c app/
开发人员:
framework:
router:
resource: "%kernel.root_dir%/config/routing_dev.yml"
strict_requirements: true
profiler: { only_exceptions: false }
web_profiler:
toolbar: true
intercept_redirects: false
测试cfg:
imports:
- { resource: config_dev.yml }
framework:
test: ~
session:
storage_id: session.storage.mock_file
profiler:
enabled: true
web_profiler:
toolbar: false
intercept_redirects: false
swiftmailer:
disable_delivery: true
security:
firewalls:
main:
http_basic: ~
顺便说一句,这些文件在gitlab和我的语言环境中是相同的。
我还尝试了mailer的以下功能:
mailer_transport: smtp
mailer_host: 127.0.0.1
mailer_user: null
mailer_password: null
mailer_port: 465
还有一个真正的邮件服务器作为我最后的希望。。
我是否需要在CI上进行一些其他设置,或者可能出现什么问题?
Thx.我也在使用gitlab ci,从来没有遇到过这个问题-我也不认为ci运行程序有问题 您确定您在config_test.yml中有这个,并且在测试本地时使用test env吗
framework:
profiler:
enabled: true
我也在使用gitlab ci,从来没有遇到过这个问题——我也不认为ci Runner有问题 您确定您在config_test.yml中有这个,并且在测试本地时使用test env吗
framework:
profiler:
enabled: true
当然启用了:/t测试也进入了if分支,我也得到了邮件收集器,因此它们也在工作,但是在CI上messagecount为0,但是对于您的回复,thx为什么在--env=dev(默认)中设置了db?
参数:数据库\主机:127.0.0.1数据库\端口:3306数据库\名称:somename数据库\用户:根数据库\密码:null cfg:条令:dbal:驱动程序:pdo\ U mysql主机:“%database\主机%”端口:“%database\端口%”数据库名称:“%database\名称%”用户:“%database\用户%”密码:“%database\u password%”字符集:UTF8 orm:auto_generate_proxy_classes:false naming_strategy:doctrine.orm.naming_strategy.Underline auto_mapping:true
Its enabled of Ourse:/测试进入if分支,我也得到了邮件收集器,因此这些都在工作,但CI上的messagecount为0,但您的回复为thx为什么数据库设置是否在--env=dev(默认值)?参数:数据库\u主机:127.0.0.1数据库\u端口:3306数据库\u名称:somename数据库\u用户:根数据库\u密码:null cfg:doctor:dbal:driver:pdo\u mysql主机:“%database\u主机%”端口:“%database\u端口%”dbname:“%database\u name%”用户:“%database\u user%”密码:“%database\u password%“字符集:UTF8 orm:auto_generate_proxy_Class:false naming_strategy:doctrine.orm.naming_strategy.Underline auto_mapping:true
找到解决方案了吗?我也遇到了这个问题。对不起,我不记得了,但我不认为你找到了解决办法吗?我也遇到了这个问题。对不起,我不记得了,但我不这么认为