Browse Source

Update method signatures and fix method calls.

ADmad 7 years ago
parent
commit
18db0d7dd5

+ 27 - 27
src/TestSuite/EmailTrait.php

@@ -55,10 +55,10 @@ trait EmailTrait
      * Asserts an expected number of emails were sent
      *
      * @param int $count Email count
-     * @param string|null $message Message
+     * @param string $message Message
      * @return void
      */
-    public function assertMailCount(int $count, ?string $message = null): void
+    public function assertMailCount(int $count, string $message = ''): void
     {
         $this->assertThat($count, new MailCount(), $message);
     }
@@ -66,10 +66,10 @@ trait EmailTrait
      *
      * Asserts that no emails were sent
      *
-     * @param string|null $message Message
+     * @param string $message Message
      * @return void
      */
-    public function assertNoMailSent(?string $message = null): void
+    public function assertNoMailSent(string $message = ''): void
     {
         $this->assertThat(null, new NoMailSent(), $message);
     }
@@ -79,10 +79,10 @@ trait EmailTrait
      *
      * @param int $at Email index
      * @param string $address Email address
-     * @param string|null $message Message
+     * @param string $message Message
      * @return void
      */
-    public function assertMailSentToAt(int $at, string $address, ?string $message = null): void
+    public function assertMailSentToAt(int $at, string $address, string $message = ''): void
     {
         $this->assertThat($address, new MailSentTo($at), $message);
     }
@@ -92,10 +92,10 @@ trait EmailTrait
      *
      * @param int $at Email index
      * @param string $address Email address
-     * @param string|null $message Message
+     * @param string $message Message
      * @return void
      */
-    public function assertMailSentFromAt(int $at, string $address, ?string $message = null): void
+    public function assertMailSentFromAt(int $at, string $address, string $message = ''): void
     {
         $this->assertThat($address, new MailSentFrom($at), $message);
     }
@@ -105,10 +105,10 @@ trait EmailTrait
      *
      * @param int $at Email index
      * @param string $contents Contents
-     * @param string|null $message Message
+     * @param string $message Message
      * @return void
      */
-    public function assertMailContainsAt(int $at, string $contents, ?string $message = null): void
+    public function assertMailContainsAt(int $at, string $contents, string $message = ''): void
     {
         $this->assertThat($contents, new MailContains($at), $message);
     }
@@ -118,10 +118,10 @@ trait EmailTrait
      *
      * @param int $at Email index
      * @param string $contents Contents
-     * @param string|null $message Message
+     * @param string $message Message
      * @return void
      */
-    public function assertMailContainsHtmlAt(int $at, string $contents, ?string $message = null): void
+    public function assertMailContainsHtmlAt(int $at, string $contents, string $message = ''): void
     {
         $this->assertThat($contents, new MailContainsHtml($at), $message);
     }
@@ -131,10 +131,10 @@ trait EmailTrait
      *
      * @param int $at Email index
      * @param string $contents Contents
-     * @param string|null $message Message
+     * @param string $message Message
      * @return void
      */
-    public function assertMailContainsTextAt(int $at, string $contents, ?string $message = null): void
+    public function assertMailContainsTextAt(int $at, string $contents, string $message = ''): void
     {
         $this->assertThat($contents, new MailContainsText($at), $message);
     }
@@ -145,10 +145,10 @@ trait EmailTrait
      * @param int $at Email index
      * @param string $expected Contents
      * @param string $parameter Email getter parameter (e.g. "cc", "subject")
-     * @param string|null $message Message
+     * @param string $message Message
      * @return void
      */
-    public function assertMailSentWithAt(int $at, string $expected, string $parameter, ?string $message = null): void
+    public function assertMailSentWithAt(int $at, string $expected, string $parameter, string $message = ''): void
     {
         $this->assertThat($expected, new MailSentWith($at, $parameter), $message);
     }
@@ -160,7 +160,7 @@ trait EmailTrait
      * @param string $message Message
      * @return void
      */
-    public function assertMailSentTo(string $address, ?string $message = null): void
+    public function assertMailSentTo(string $address, string $message = ''): void
     {
         $this->assertThat($address, new MailSentTo(), $message);
     }
@@ -169,10 +169,10 @@ trait EmailTrait
      * Asserts an email was sent from an address
      *
      * @param string $address Email address
-     * @param string|null $message Message
+     * @param string $message Message
      * @return void
      */
-    public function assertMailSentFrom(string $address, ?string $message = null): void
+    public function assertMailSentFrom(string $address, string $message = ''): void
     {
         $this->assertThat($address, new MailSentFrom(), $message);
     }
@@ -181,10 +181,10 @@ trait EmailTrait
      * Asserts an email contains expected contents
      *
      * @param string $contents Contents
-     * @param string|null $message Message
+     * @param string $message Message
      * @return void
      */
-    public function assertMailContains(string $contents, ?string $message = null): void
+    public function assertMailContains(string $contents, string $message = ''): void
     {
         $this->assertThat($contents, new MailContains(), $message);
     }
@@ -193,10 +193,10 @@ trait EmailTrait
      * Asserts an email contains expected html contents
      *
      * @param string $contents Contents
-     * @param string|null $message Message
+     * @param string $message Message
      * @return void
      */
-    public function assertMailContainsHtml(string $contents, ?string $message = null): void
+    public function assertMailContainsHtml(string $contents, string $message = ''): void
     {
         $this->assertThat($contents, new MailContainsHtml(), $message);
     }
@@ -205,10 +205,10 @@ trait EmailTrait
      * Asserts an email contains expected text contents
      *
      * @param string $contents Contents
-     * @param string|null $message Message
+     * @param string $message Message
      * @return void
      */
-    public function assertMailContainsText(string $contents, ?string $message = null): void
+    public function assertMailContainsText(string $contents, string $message = ''): void
     {
         $this->assertThat($contents, new MailContainsText(), $message);
     }
@@ -218,10 +218,10 @@ trait EmailTrait
      *
      * @param string $expected Contents
      * @param string $parameter Email getter parameter (e.g. "cc", "subject")
-     * @param string|null $message Message
+     * @param string $message Message
      * @return void
      */
-    public function assertMailSentWith(string $expected, string $parameter, ?string $message = null): void
+    public function assertMailSentWith(string $expected, string $parameter, string $message = ''): void
     {
         $this->assertThat($expected, new MailSentWith(null, $parameter), $message);
     }

+ 5 - 5
src/TestSuite/IntegrationTestTrait.php

@@ -758,7 +758,7 @@ trait IntegrationTestTrait
      * @param string $message Custom message for failure.
      * @return void
      */
-    public function assertResponseOk(?string $message = null): void
+    public function assertResponseOk(string $message = ''): void
     {
         $this->assertThat(null, new StatusOk($this->_response), $message);
     }
@@ -769,7 +769,7 @@ trait IntegrationTestTrait
      * @param string $message Custom message for failure.
      * @return void
      */
-    public function assertResponseSuccess(?string $message = null): void
+    public function assertResponseSuccess(string $message = ''): void
     {
         $this->assertThat(null, new StatusSuccess($this->_response), $message);
     }
@@ -780,7 +780,7 @@ trait IntegrationTestTrait
      * @param string $message Custom message for failure.
      * @return void
      */
-    public function assertResponseError(?string $message = null): void
+    public function assertResponseError(string $message = ''): void
     {
         $this->assertThat(null, new StatusError($this->_response), $message);
     }
@@ -791,7 +791,7 @@ trait IntegrationTestTrait
      * @param string $message Custom message for failure.
      * @return void
      */
-    public function assertResponseFailure(?string $message = null): void
+    public function assertResponseFailure(string $message = ''): void
     {
         $this->assertThat(null, new StatusFailure($this->_response), $message);
     }
@@ -803,7 +803,7 @@ trait IntegrationTestTrait
      * @param string $message Custom message for failure.
      * @return void
      */
-    public function assertResponseCode(int $code, ?string $message = null): void
+    public function assertResponseCode(int $code, string $message = ''): void
     {
         $this->assertThat($code, new StatusCode($this->_response), $message);
     }

+ 1 - 1
tests/TestCase/Filesystem/FolderTest.php

@@ -104,7 +104,7 @@ class FolderTest extends TestCase
 
         // is "/" in "/tests/test_app/"
         $result = $Base->inPath(realpath(DS), true);
-        $this->assertFalse($result, true);
+        $this->assertFalse($result);
 
         // is "/tests/test_app/" in "/tests/test_app/"
         $result = $Base->inPath($basePath, true);

+ 1 - 1
tests/TestCase/Log/Engine/ConsoleLogTest.php

@@ -33,7 +33,7 @@ class ConsoleLogTest extends TestCase
         if (DIRECTORY_SEPARATOR !== '\\') { //skip if test is on windows
             $output->expects($this->at(0))
                 ->method('setOutputAs')
-                ->with($this->stringContains(ConsoleOutput::COLOR));
+                ->with($this->stringContains((string)ConsoleOutput::COLOR));
         }
         $message = ' Error: oh noes</error>';
         $output->expects($this->at(1))

+ 1 - 1
tests/TestCase/Mailer/EmailTest.php

@@ -2038,7 +2038,7 @@ class EmailTest extends TestCase
         $this->Email->reset();
 
         $this->assertSame('utf-8', $this->Email->charset, $this->Email->charset);
-        $this->assertNull($this->Email->headerCharset, $this->Email->headerCharset);
+        $this->assertNull($this->Email->headerCharset);
     }
 
     /**