Browse Source

Move 'at' test to new function, skip if not supported

gregs 4 years ago
parent
commit
09acef9278
1 changed files with 18 additions and 3 deletions
  1. 18 3
      tests/TestCase/TestSuite/EmailTraitTest.php

+ 18 - 3
tests/TestCase/TestSuite/EmailTraitTest.php

@@ -110,9 +110,6 @@ 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');
@@ -124,6 +121,24 @@ class EmailTraitTest extends TestCase
     }
 
     /**
+     * confirm that "at 0" is really testing email 0, not all the emails
+     *
+     * @return void
+     */
+    public function testAt0()
+    {
+        $this->skipIf(!class_exists('PHPUnit\Framework\Constraint\LogicalNot'), 'LogicalNot class not supported on PHP5.6');
+
+        $this->assertNoMailSent();
+
+        $this->sendEmails();
+
+        $this->assertMailCount(3);
+
+        $this->assertThat('alternate@example.com', new LogicalNot(new MailSentFrom(0)));
+    }
+
+    /**
      * tests assertNoMailSent fails when no mail is sent
      *
      * @return void