Closed ruudk closed 12 years ago
Could you explain how to run the tests? Should I run Tests/Adapter.php
?
Where should I place my Postmark API key? Or is there a test mode so that you don't waste credits? Also, you have hard assertions like this:
$this->assertEqual($debugData['json'], '{"Subject":"The subject","From":"\"Foo Bar\" <foo@bar.com>","To":"\"John Smith\" <john@smith.com>","TextBody":"Test message"}');
This isn't going to work because Foo Bar foo@bar.com does not match the signature that I have in my Postmark account.
The test are run against the postmark debug api key, which doesn't send any emails, but return the correct JSON responses. The test files are Tests_Log, Tests_Base and Tests_Attachment. They utilize the simpletest testing framework.
Weird, now it works :)
I'm going to write some tests... standby
Hm. We probably shouldn't depend on an alpha version of the test framework. I am using 1.0.1. Thanks for your work!
hello guys, will this be merged or should we do it manually?
thanks
I don't have time at the moment.. I will look into this later, maybe you should merge it yourself..
I've added @chrisbarr 's PR to allow count().
Thanks
Will this be merged in or should I just do it locally? :)
Hi, thank you for the code to do the batch process.
I have this working:
Mail_Postmark::compose()
->addTo('address@example.com', 'Name')
->subject('Subject')
->messagePlain('Plaintext message')
->tag('Test tag')
->send();
but this does not:
$batch = new Mail_Postmark_Batch();
$batch->add(Mail_Postmark::compose()
->addTo('jane@doe.com', 'Name')
->subject('Subject')
->messagePlain('Plaintext message'));
$batch->add(Mail_Postmark::compose()
->addTo('johnny@doe.com', 'Name')
->subject('Subject')
->messagePlain('Plaintext message'));
$batch->send();
[added line breaks for formatting - in the original code they are all on one line] I am getting the following exception.
BadMethodCallException Object
(
[message:protected] => No To address is set
[string:Exception:private] =>
[code:protected] => 0
[file:protected] => D:\httpdocs\_classes\Mail\Postmark.php
[line:protected] => 583
[trace:Exception:private] => Array
(
[0] => Array
(
[file] => D:\httpdocs\_classes\Mail\Postmark.php
[line] => 294
[function] => _validateData
[class] => Mail_Postmark
[type] => ->
[args] => Array ( )
)
[1] => Array
(
[file] => D:\httpdocs\_classes\Mail\Postmark\Batch.php
[line] => 51
[function] => send
[class] => Mail_Postmark
[type] => ->
[args] => Array ()
)
[2] => Array
(
[file] => D:\httpdocs\sendToPostMark.php
[line] => 14
[function] => send
[class] => Mail_Postmark_Batch
[type] => ->
[args] => Array ( )
)
)
[previous:Exception:private] =>
[xdebug_message] =>
BadMethodCallException: No To address is set in D:\httpdocs\_classes\Mail\Postmark.php on line 583
Call Stack:
0.0016 457696 1. {main}() D:\httpdocs\sendToPostMark.php:0
2.2470 640864 2. Mail_Postmark_Batch->send() D:\httpdocs\sendToPostMark.php:14
2.2470 640864 3. Mail_Postmark->send() D:\httpdocs\_classes\Mail\Postmark\Batch.php:51
2.2470 640864 4. Mail_Postmark->_validateData() D:\httpdocs\_classes\Mail\Postmark.php:294
)
In the original Postmark class, we have
public function _validateData() {
if ($this->_from['address'] === null) {
throw new BadMethodCallException('From address is not set');
}
if (empty($this->_to)) {
throw new BadMethodCallException('No To address is set');
}
if (!isset($this->_subject)) {
throw new BadMethodCallException('Subject is not set');
}
}
the check for $this->_to is true as the data is in
$this->_messages[n]->_to
Where n is the message number.
Reading the comments above, no one else seems to be having this problem, so I guess I have missed something. I would be very grateful for any pointers on where I have gone wrong.
Thank you for your help [sorry about the formatting....]
That was quick!
Can you take away the "_" from the methods you made public? Could please also add unit tests to test the new functionality?
Thanks.