Browse Source

Move `TestMailer` to `TestApp`

Jad Bitar 11 years ago
parent
commit
0e00baf8bc
2 changed files with 40 additions and 15 deletions
  1. 8 15
      tests/TestCase/Mailer/MailerTest.php
  2. 32 0
      tests/test_app/TestApp/Mailer/TestMailer.php

+ 8 - 15
tests/TestCase/Mailer/MailerTest.php

@@ -15,14 +15,7 @@ namespace Cake\Test\TestCase\Mailer;
 use Cake\Mailer\Email;
 use Cake\Mailer\Mailer;
 use Cake\TestSuite\TestCase;
-
-class TestMailer extends Mailer
-{
-    public function getEmailForAssertion()
-    {
-        return $this->_email;
-    }
-}
+use TestApp\Mailer\TestMailer;
 
 class MailerTest extends TestCase
 {
@@ -57,7 +50,7 @@ class MailerTest extends TestCase
     public function testLayout()
     {
         $result = (new TestMailer())->layout('foo');
-        $this->assertInstanceOf('Cake\Test\TestCase\Mailer\TestMailer', $result);
+        $this->assertInstanceOf('TestApp\Mailer\TestMailer', $result);
         $this->assertEquals('foo', $result->layout);
     }
 
@@ -68,21 +61,21 @@ class MailerTest extends TestCase
             ->method('setHeaders')
             ->with([]);
         $result = (new TestMailer($email))->setHeaders([]);
-        $this->assertInstanceOf('Cake\Test\TestCase\Mailer\TestMailer', $result);
+        $this->assertInstanceOf('TestApp\Mailer\TestMailer', $result);
 
         $email = $this->getMockForEmail('addHeaders');
         $email->expects($this->once())
             ->method('addHeaders')
             ->with([]);
         $result = (new TestMailer($email))->addHeaders([]);
-        $this->assertInstanceOf('Cake\Test\TestCase\Mailer\TestMailer', $result);
+        $this->assertInstanceOf('TestApp\Mailer\TestMailer', $result);
 
         $email = $this->getMockForEmail('attachments');
         $email->expects($this->once())
             ->method('attachments')
             ->with([]);
         $result = (new TestMailer($email))->attachments([]);
-        $this->assertInstanceOf('Cake\Test\TestCase\Mailer\TestMailer', $result);
+        $this->assertInstanceOf('TestApp\Mailer\TestMailer', $result);
     }
 
     public function testSet()
@@ -92,14 +85,14 @@ class MailerTest extends TestCase
             ->method('viewVars')
             ->with(['key' => 'value']);
         $result = (new TestMailer($email))->set('key', 'value');
-        $this->assertInstanceOf('Cake\Test\TestCase\Mailer\TestMailer', $result);
+        $this->assertInstanceOf('TestApp\Mailer\TestMailer', $result);
 
         $email = $this->getMockForEmail('viewVars');
         $email->expects($this->once())
             ->method('viewVars')
             ->with(['key' => 'value']);
         $result = (new TestMailer($email))->set(['key' => 'value']);
-        $this->assertInstanceOf('Cake\Test\TestCase\Mailer\TestMailer', $result);
+        $this->assertInstanceOf('TestApp\Mailer\TestMailer', $result);
     }
 
     public function testSend()
@@ -109,7 +102,7 @@ class MailerTest extends TestCase
             ->method('send')
             ->will($this->returnValue([]));
 
-        $mailer = $this->getMock('Cake\Test\TestCase\Mailer\TestMailer', ['test'], [$email]);
+        $mailer = $this->getMock('TestApp\Mailer\TestMailer', ['test'], [$email]);
         $mailer->expects($this->once())
             ->method('test')
             ->with('foo', 'bar');

+ 32 - 0
tests/test_app/TestApp/Mailer/TestMailer.php

@@ -0,0 +1,32 @@
+<?php
+/**
+ * Test Suite Test App Logging stream class.
+ *
+ * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
+ * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
+ *
+ * Licensed under The MIT License
+ * For full copyright and license information, please see the LICENSE.txt
+ * Redistributions of files must retain the above copyright notice
+ *
+ * @copyright     Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
+ * @link          http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
+ * @since         1.3.0
+ * @license       http://www.opensource.org/licenses/mit-license.php MIT License
+ */
+namespace TestApp\Mailer;
+
+use Cake\Mailer\Mailer;
+
+/**
+ * Test Suite Test App Mailer class.
+ *
+ */
+class TestMailer extends Mailer
+{
+
+    public function getEmailForAssertion()
+    {
+        return $this->_email;
+    }
+}