Browse Source

Add a unit test for 'at 0'

gregs 4 years ago
parent
commit
8a50854beb
1 changed files with 5 additions and 0 deletions
  1. 5 0
      tests/TestCase/TestSuite/EmailTraitTest.php

+ 5 - 0
tests/TestCase/TestSuite/EmailTraitTest.php

@@ -16,10 +16,12 @@ namespace Cake\Test\TestCase\TestSuite;
 
 use Cake\Mailer\Email;
 use Cake\Mailer\TransportFactory;
+use Cake\TestSuite\Constraint\Email\MailSentFrom;
 use Cake\TestSuite\EmailTrait;
 use Cake\TestSuite\TestCase;
 use Cake\TestSuite\TestEmailTransport;
 use PHPUnit\Framework\AssertionFailedError;
+use PHPUnit\Framework\Constraint\LogicalNot;
 
 /**
  * Tests EmailTrait assertions
@@ -108,6 +110,9 @@ class EmailTraitTest extends TestCase
         $this->assertMailSentFromAt(0, 'default@example.com');
         $this->assertMailSentFromAt(1, 'alternate@example.com');
 
+        // Confirm that "at 0" is really testing email 0, not all the emails
+        $this->assertThat('alternate@example.com', new LogicalNot(new MailSentFrom(0)));
+
         $this->assertMailSentToAt(0, 'to@example.com');
         $this->assertMailSentToAt(1, 'to2@example.com');
         $this->assertMailSentToAt(2, 'to3@example.com');