Browse Source

Add new test plugin to isolate autoload test from autoload with bootstrap test

Walther Lalk 11 years ago
parent
commit
5f2cdc520c

+ 5 - 5
tests/TestCase/Core/PluginTest.php

@@ -95,18 +95,18 @@ class PluginTest extends TestCase
      */
     public function testLoadSingleWithAutoloadAndBootstrap()
     {
-        $this->assertFalse(class_exists('Company\TestPluginThree\Utility\Hello'));
+        $this->assertFalse(class_exists('Company\TestPluginFive\Utility\Hello'));
         Plugin::load(
-            'Company/TestPluginThree',
+            'Company/TestPluginFive',
             [
                 'autoload' => true,
                 'bootstrap' => true
             ]
         );
-        $this->assertTrue(Configure::read('PluginTest.test_plugin_three.autoload'));
-        $this->assertEquals('loaded plugin three bootstrap', Configure::read('PluginTest.test_plugin_three.bootstrap'));
+        $this->assertTrue(Configure::read('PluginTest.test_plugin_five.autoload'));
+        $this->assertEquals('loaded plugin five bootstrap', Configure::read('PluginTest.test_plugin_five.bootstrap'));
         $this->assertTrue(
-            class_exists('Company\TestPluginThree\Utility\Hello'),
+            class_exists('Company\TestPluginFive\Utility\Hello'),
             'Class should be loaded'
         );
     }

+ 5 - 0
tests/test_app/Plugin/Company/TestPluginFive/config/bootstrap.php

@@ -0,0 +1,5 @@
+<?php
+use Cake\Core\Configure;
+
+Configure::write('PluginTest.test_plugin_five.bootstrap', 'loaded plugin five bootstrap');
+Configure::write('PluginTest.test_plugin_five.autoload', class_exists('Company\TestPluginFive\Utility\Hello'));

+ 28 - 0
tests/test_app/Plugin/Company/TestPluginFive/src/Utility/Hello.php

@@ -0,0 +1,28 @@
+<?php
+/**
+ * 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
+ * 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         3.0.0
+ * @license       http://www.opensource.org/licenses/mit-license.php MIT License
+ */
+namespace Company\TestPluginFive\Utility;
+
+class Hello
+{
+
+    /**
+     * foo method
+     *
+     * @return string
+     */
+    public function foo()
+    {
+        return 'bar';
+    }
+}