-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changed service definition + fixed testcases #29
Conversation
@Nightbr Phpsepc still fails because the function subscriberHash is now static in DrewM\MailChimp. Any idea on how to fix this? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you want to use ids for services, you have to set class manually (no autowire here).
For the problem with drewm/mailchimp-api. You need to replace in ListRepository.php
:
$this->mailchimp->subscriberHash
by MailChimp::subscriberHash
because subscriberHash became a static method.
After that, you need to fix ListRepositoryTest.php (no time for this, sorry, but if you can manage it, we will be able to merge this and release a version 👍 ).
Welp/MailchimpBundle/Subscriber/ListRepository
48 - it subscribe a subscriber
unexpected method call on Double\DrewM\MailChimp\MailChimp\P34:
- put(
"lists/ba039c6198/members/b1a29fd58778c40c7f15f06a334dc691",
["email_address" => "[email protected]", "merge_fields" => ["FNAME" => "Charles", "LNAME" => "Terrasse"], "language" => "fr", "email_type" => "html", "status" => "subscribed"]
)
expected calls were:
- subscriberHash(
exact("[email protected]")
)
- success(
)
- get(
exact("lists/ba039c6198")
)
- get(
exact("lists/notfound")
)
- put(
exact("lists/ba039c6198/members/md5ofthesubscribermail"),
exact(["email_address" => "[email protected]", "merge_fields" => ["FNAME" => "Charles", "LNAME" => "Terrasse"], "language" => "fr", "email_type" => "html", "status" => "subscribed"])
)
- put(
exact("lists/ba039c6198/members/md5ofthesubscribermail"),
exact(["email_address" => "[email protected]", "merge_fields" => ["FNAME" => "Charles", "LNAME" => "Terrasse"], "language" => "fr", "email_type" => "html", "status" => "unsubscribed"])
)
- put(
exact("lists/ba039c6198/members/md5ofthesubscribermail"),
exact(["email_address" => "[email protected]", "merge_fields" => ["FNAME" => "Charles", "LNAME" => "Terrasse"], "language" => "fr", "email_type" => "html", "status" => "pending"])
)
- put(
exact("lists/ba039c6198/members/md5ofthesubscribermail"),
exact(["email_address" => "[email protected]", "merge_fields" => ["FNAME" => "Charles", "LNAME" => "Terrasse"], "language" => "fr", "email_type" => "html", "status" => "cleaned"])
)
Welp/MailchimpBundle/Subscriber/ListRepository
59 - it unsubscribe a subscriber
unexpected method call on Double\DrewM\MailChimp\MailChimp\P36:
- put(
"lists/ba039c6198/members/b1a29fd58778c40c7f15f06a334dc691",
["email_address" => "[email protected]", "merge_fields" => ["FNAME" => "Charles", "LNAME" => "Terrasse"], "language" => "fr", "email_type" => "html", "status" => "unsubscribed"]
)
expected calls were:
- subscriberHash(
exact("[email protected]")
)
- success(
)
- get(
exact("lists/ba039c6198")
)
- get(
exact("lists/notfound")
)
- put(
exact("lists/ba039c6198/members/md5ofthesubscribermail"),
exact(["email_address" => "[email protected]", "merge_fields" => ["FNAME" => "Charles", "LNAME" => "Terrasse"], "language" => "fr", "email_type" => "html", "status" => "subscribed"])
)
- put(
exact("lists/ba039c6198/members/md5ofthesubscribermail"),
exact(["email_address" => "[email protected]", "merge_fields" => ["FNAME" => "Charles", "LNAME" => "Terrasse"], "language" => "fr", "email_type" => "html", "status" => "unsubscribed"])
)
- put(
exact("lists/ba039c6198/members/md5ofthesubscribermail"),
exact(["email_address" => "[email protected]", "merge_fields" => ["FNAME" => "Charles", "LNAME" => "Terrasse"], "language" => "fr", "email_type" => "html", "status" => "pending"])
)
- put(
exact("lists/ba039c6198/members/md5ofthesubscribermail"),
exact(["email_address" => "[email protected]", "merge_fields" => ["FNAME" => "Charles", "LNAME" => "Terrasse"], "language" => "fr", "email_type" => "html", "status" => "cleaned"])
)
Welp/MailchimpBundle/Subscriber/ListRepository
64 - it pending a subscriber
unexpected method call on Double\DrewM\MailChimp\MailChimp\P38:
- put(
"lists/ba039c6198/members/b1a29fd58778c40c7f15f06a334dc691",
["email_address" => "[email protected]", "merge_fields" => ["FNAME" => "Charles", "LNAME" => "Terrasse"], "language" => "fr", "email_type" => "html", "status" => "pending"]
)
expected calls were:
- subscriberHash(
exact("[email protected]")
)
- success(
)
- get(
exact("lists/ba039c6198")
)
- get(
exact("lists/notfound")
)
- put(
exact("lists/ba039c6198/members/md5ofthesubscribermail"),
exact(["email_address" => "[email protected]", "merge_fields" => ["FNAME" => "Charles", "LNAME" => "Terrasse"], "language" => "fr", "email_type" => "html", "status" => "subscribed"])
)
- put(
exact("lists/ba039c6198/members/md5ofthesubscribermail"),
exact(["email_address" => "[email protected]", "merge_fields" => ["FNAME" => "Charles", "LNAME" => "Terrasse"], "language" => "fr", "email_type" => "html", "status" => "unsubscribed"])
)
- put(
exact("lists/ba039c6198/members/md5ofthesubscribermail"),
exact(["email_address" => "[email protected]", "merge_fields" => ["FNAME" => "Charles", "LNAME" => "Terrasse"], "language" => "fr", "email_type" => "html", "status" => "pending"])
)
- put(
exact("lists/ba039c6198/members/md5ofthesubscribermail"),
exact(["email_address" => "[email protected]", "merge_fields" => ["FNAME" => "Charles", "LNAME" => "Terrasse"], "language" => "fr", "email_type" => "html", "status" => "cleaned"])
)
Welp/MailchimpBundle/Subscriber/ListRepository
69 - it clean a subscriber
unexpected method call on Double\DrewM\MailChimp\MailChimp\P40:
- put(
"lists/ba039c6198/members/b1a29fd58778c40c7f15f06a334dc691",
["email_address" => "[email protected]", "merge_fields" => ["FNAME" => "Charles", "LNAME" => "Terrasse"], "language" => "fr", "email_type" => "html", "status" => "cleaned"]
)
expected calls were:
- subscriberHash(
exact("[email protected]")
)
- success(
)
- get(
exact("lists/ba039c6198")
)
- get(
exact("lists/notfound")
)
- put(
exact("lists/ba039c6198/members/md5ofthesubscribermail"),
exact(["email_address" => "[email protected]", "merge_fields" => ["FNAME" => "Charles", "LNAME" => "Terrasse"], "language" => "fr", "email_type" => "html", "status" => "subscribed"])
)
- put(
exact("lists/ba039c6198/members/md5ofthesubscribermail"),
exact(["email_address" => "[email protected]", "merge_fields" => ["FNAME" => "Charles", "LNAME" => "Terrasse"], "language" => "fr", "email_type" => "html", "status" => "unsubscribed"])
)
- put(
exact("lists/ba039c6198/members/md5ofthesubscribermail"),
exact(["email_address" => "[email protected]", "merge_fields" => ["FNAME" => "Charles", "LNAME" => "Terrasse"], "language" => "fr", "email_type" => "html", "status" => "pending"])
)
- put(
exact("lists/ba039c6198/members/md5ofthesubscribermail"),
exact(["email_address" => "[email protected]", "merge_fields" => ["FNAME" => "Charles", "LNAME" => "Terrasse"], "language" => "fr", "email_type" => "html", "status" => "cleaned"])
)
Welp/MailchimpBundle/Subscriber/ListRepository
74 - it delete a subscriber
unexpected method call on Double\DrewM\MailChimp\MailChimp\P42:
- delete(
"lists/ba039c6198/members/b1a29fd58778c40c7f15f06a334dc691"
)
expected calls were:
- subscriberHash(
exact("[email protected]")
)
- success(
)
- get(
exact("lists/ba039c6198")
)
- get(
exact("lists/notfound")
)
- put(
exact("lists/ba039c6198/members/md5ofthesubscribermail"),
exact(["email_address" => "[email protected]", "merge_fields" => ["FNAME" => "Charles", "LNAME" => "Terrasse"], "language" => "fr", "email_type" => "html", "status" => "subscribed"])
)
- put(
exact("lists/ba039c6198/members/md5ofthesubscribermail"),
exact(["email_address" => "[email protected]", "merge_fields" => ["FNAME" => "Charles", "LNAME" => "Terrasse"], "language" => "fr", "email_type" => "html", "status" => "unsubscribed"])
)
- put(
exact("lists/ba039c6198/members/md5ofthesubscribermail"),
exact(["email_address" => "[email protected]", "merge_fields" => ["FNAME" => "Charles", "LNAME" => "Terrasse"], "language" => "fr", "email_type" => "html", "status" => "pending"])
)
- put(
exact("lists/ba039c6198/members/md5ofthesubscribermail"),
exact(["email_address" => "[email protected]", "merge_fields" => ["FNAME" => "Charles", "LNAME" => "Terrasse"], "language" => "fr", "email_type" => "html", "status" => "cleaned"])
)
- delete(
exact("lists/ba039c6198/members/md5ofthesubscribermail")
)
Welp/MailchimpBundle/Subscriber/ListRepository
81 - it update a subscriber
unexpected method call on Double\DrewM\MailChimp\MailChimp\P44:
- patch(
"lists/ba039c6198/members/b1a29fd58778c40c7f15f06a334dc691",
["email_address" => "[email protected]", "merge_fields" => ["FNAME" => "Charles", "LNAME" => "Terrasse"], "language" => "fr", "email_type" => "html"]
)
expected calls were:
- subscriberHash(
exact("[email protected]")
)
- success(
)
- get(
exact("lists/ba039c6198")
)
- get(
exact("lists/notfound")
)
- put(
exact("lists/ba039c6198/members/md5ofthesubscribermail"),
exact(["email_address" => "[email protected]", "merge_fields" => ["FNAME" => "Charles", "LNAME" => "Terrasse"], "language" => "fr", "email_type" => "html", "status" => "subscribed"])
)
- put(
exact("lists/ba039c6198/members/md5ofthesubscribermail"),
exact(["email_address" => "[email protected]", "merge_fields" => ["FNAME" => "Charles", "LNAME" => "Terrasse"], "language" => "fr", "email_type" => "html", "status" => "unsubscribed"])
)
- put(
exact("lists/ba039c6198/members/md5ofthesubscribermail"),
exact(["email_address" => "[email protected]", "merge_fields" => ["FNAME" => "Charles", "LNAME" => "Terrasse"], "language" => "fr", "email_type" => "html", "status" => "pending"])
)
- put(
exact("lists/ba039c6198/members/md5ofthesubscribermail"),
exact(["email_address" => "[email protected]", "merge_fields" => ["FNAME" => "Charles", "LNAME" => "Terrasse"], "language" => "fr", "email_type" => "html", "status" => "cleaned"])
)
- patch(
exact("lists/ba039c6198/members/md5ofthesubscribermail"),
exact(["email_address" => "[email protected]", "merge_fields" => ["FNAME" => "Charles", "LNAME" => "Terrasse"], "language" => "fr", "email_type" => "html"])
)
Add to that, I think we should lock the version of drewm/mailchimp-api to 2.5.* to avoid this sort of thing in the future. composer.json |
So i changed "md5ofthesubscribermail" for the md5 hash of the test email because you can not mock a static method. In there Github they suggest to create your own wrapper/proxy but that might be a little to much for this one thing? |
188d748
to
b6fb581
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Thanks for your contribution 🎉
I will merge this and ship a release soon :)
As mentioned in #27 I think it is better to use keys for the service definition, also most of the services already had keys so this is more consistent.
In addition i fixed the failing tests.