Skip to content

[3n]-[1568] 単体テストでSwift_Mailerを模擬する方法 #123

@ndquocphong

Description

@ndquocphong

概要(Overview)

  • In the test case, it needs control Swift_Mailer be fail/success sending email.

期待する内容(Expect) or 要望 (Requirement)

  • \Plugin\MailMagazine\Tests\Service\MailMagazineServiceTest::setup
$this->app['mailer'] = $this->mailer = $this->getMockBuilder('\Swift_Mailer')->disableOriginalConstructor()->getMock();

Swift_Mailer is a service now, it assigned on container, I can not set the mock of Swift_Mailer to container on run time. Container was freeze mode.

再現手順(Procedure)

  • None

環境 (environment)

  • EC-CUBE: 3.x.x
  • PHP: x.x.x
  • DB:
    • PostgreSQL x.x.x
    • MySQL x.x.x

関連情報 (Ref)

https://github.com/eccubevn/mail-magazine-plugin/blob/master/Tests/Service/MailMagazineServiceTest.php#L23
https://github.com/eccubevn/mail-magazine-plugin/blob/master/Tests/Service/MailMagazineServiceTest.php#L576

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions