Browse Source

Merge pull request #11736 from cakephp/bugfix/view-block

Make view block inst. a bit less internally coupled.
Mark Story 8 years ago
parent
commit
4bfb5386fa
3 changed files with 11 additions and 3 deletions
  1. 1 1
      src/Event/EventDispatcherTrait.php
  2. 8 1
      src/View/View.php
  3. 2 1
      tests/TestCase/Error/DebuggerTest.php

+ 1 - 1
src/Event/EventDispatcherTrait.php

@@ -33,7 +33,7 @@ trait EventDispatcherTrait
      *
      * @var string
      */
-    protected $_eventClass = '\Cake\Event\Event';
+    protected $_eventClass = Event::class;
 
     /**
      * Returns the Cake\Event\EventManager manager instance for this object.

+ 8 - 1
src/View/View.php

@@ -279,6 +279,13 @@ class View implements EventDispatcherInterface
     protected $_stack = [];
 
     /**
+     * ViewBlock class.
+     *
+     * @var string
+     */
+    protected $_viewBlockClass = ViewBlock::class;
+
+    /**
      * Constant for view file type 'view'
      *
      * @var string
@@ -359,7 +366,7 @@ class View implements EventDispatcherInterface
                 'webroot' => '/'
             ]);
         }
-        $this->Blocks = new ViewBlock();
+        $this->Blocks = new $this->_viewBlockClass();
         $this->initialize();
         $this->loadHelpers();
     }

+ 2 - 1
tests/TestCase/Error/DebuggerTest.php

@@ -387,8 +387,9 @@ object(Cake\View\View) {
 	[protected] _current => null
 	[protected] _currentType => ''
 	[protected] _stack => []
+	[protected] _viewBlockClass => 'Cake\View\ViewBlock'
 	[protected] _eventManager => object(Cake\Event\EventManager) {}
-	[protected] _eventClass => '\Cake\Event\Event'
+	[protected] _eventClass => 'Cake\Event\Event'
 	[protected] _viewBuilder => null
 }
 TEXT;