Browse Source

Fix deprecated feature use in the test suite for View classes.

Mark Story 8 years ago
parent
commit
81267e5e7c

+ 4 - 0
src/View/View.php

@@ -1107,9 +1107,11 @@ class View implements EventDispatcherInterface
     public function __get($name)
     {
         if ($name === 'view') {
+            deprecationWarning('The `view` property is deprecated. Use View::getTemplate() instead.');
             return $this->template;
         }
         if ($name === 'viewPath') {
+            deprecationWarning('The `viewPath` property is deprecated. Use View::getTemplatePath() instead.');
             return $this->templatePath;
         }
 
@@ -1133,11 +1135,13 @@ class View implements EventDispatcherInterface
     public function __set($name, $value)
     {
         if ($name === 'view') {
+            deprecationWarning('The `view` property is deprecated. Use View::setTemplate() instead.');
             $this->template = $value;
 
             return;
         }
         if ($name === 'viewPath') {
+            deprecationWarning('The `viewPath` property is deprecated. Use View::setTemplatePath() instead.');
             $this->templatePath = $value;
 
             return;

+ 37 - 34
tests/TestCase/View/Helper/FormHelperTest.php

@@ -643,7 +643,7 @@ class FormHelperTest extends TestCase
      */
     public function testSubmitTemplateVars()
     {
-        $this->Form->templates([
+        $this->Form->setTemplates([
             'inputSubmit' => '<input custom="{{forinput}}" type="{{type}}"{{attrs}}/>',
             'submitContainer' => '<div class="submit">{{content}}{{forcontainer}}</div>'
         ]);
@@ -4284,7 +4284,7 @@ class FormHelperTest extends TestCase
      */
     public function testLabelContainControl()
     {
-        $this->Form->templates([
+        $this->Form->setTemplates([
             'label' => '<label{{attrs}}>{{input}}{{text}}</label>',
         ]);
         $result = $this->Form->label('Person.accept_terms', 'Accept', [
@@ -4858,7 +4858,7 @@ class FormHelperTest extends TestCase
      */
     public function testRadioControlInsideLabel()
     {
-        $this->Form->templates([
+        $this->Form->setTemplates([
             'label' => '<label{{attrs}}>{{input}}{{text}}</label>',
             'radioWrapper' => '{{label}}'
         ]);
@@ -8020,7 +8020,7 @@ class FormHelperTest extends TestCase
     public function testForMagicControlNonExistingNorValidated()
     {
         $this->Form->create($this->article);
-        $this->Form->templates(['inputContainer' => '{{content}}']);
+        $this->Form->setTemplates(['inputContainer' => '{{content}}']);
         $result = $this->Form->control('non_existing_nor_validated');
         $expected = [
             'label' => ['for' => 'non-existing-nor-validated'],
@@ -8072,7 +8072,7 @@ class FormHelperTest extends TestCase
             'className' => __NAMESPACE__ . '\ContactsTable'
         ]);
         $this->Form->create([], ['context' => ['table' => 'Contacts']]);
-        $this->Form->templates(['inputContainer' => '{{content}}']);
+        $this->Form->setTemplates(['inputContainer' => '{{content}}']);
 
         $result = $this->Form->control('Contacts.name', ['label' => 'My label']);
         $expected = [
@@ -8303,7 +8303,7 @@ class FormHelperTest extends TestCase
     public function testHtml5ControlWithControl()
     {
         $this->Form->create();
-        $this->Form->templates(['inputContainer' => '{{content}}']);
+        $this->Form->setTemplates(['inputContainer' => '{{content}}']);
         $result = $this->Form->control('website', [
             'type' => 'url',
             'val' => 'http://domain.tld',
@@ -8390,7 +8390,7 @@ class FormHelperTest extends TestCase
      */
     public function testControlsNotNested()
     {
-        $this->Form->templates([
+        $this->Form->setTemplates([
             'nestingLabel' => '{{hidden}}{{input}}<label{{attrs}}>{{text}}</label>',
             'formGroup' => '{{input}}{{label}}',
         ]);
@@ -8468,7 +8468,7 @@ class FormHelperTest extends TestCase
      */
     public function testControlContainerTemplates()
     {
-        $this->Form->templates([
+        $this->Form->setTemplates([
             'checkboxContainer' => '<div class="check">{{content}}</div>',
             'radioContainer' => '<div class="rad">{{content}}</div>',
             'radioContainerError' => '<div class="rad err">{{content}}</div>',
@@ -8521,7 +8521,7 @@ class FormHelperTest extends TestCase
      */
     public function testFormGroupTemplates()
     {
-        $this->Form->templates([
+        $this->Form->setTemplates([
             'radioFormGroup' => '<div class="radio">{{label}}{{input}}</div>',
         ]);
 
@@ -8543,7 +8543,7 @@ class FormHelperTest extends TestCase
      */
     public function testResetTemplates()
     {
-        $this->Form->templates(['input' => '<input/>']);
+        $this->Form->setTemplates(['input' => '<input/>']);
         $this->assertEquals('<input/>', $this->Form->templater()->get('input'));
 
         $this->Form->resetTemplates();
@@ -8949,24 +8949,27 @@ class FormHelperTest extends TestCase
      *
      * Test the `nestedInput` parameter
      *
+     * @group deprecated
      * @return void
      */
     public function testNestedLabelInput()
     {
-        $result = $this->Form->input('foo', ['nestedInput' => true]);
-        $expected = [
-            'div' => ['class' => 'input text'],
-            'label' => ['for' => 'foo'],
-            ['input' => [
-                'type' => 'text',
-                'name' => 'foo',
-                'id' => 'foo'
-            ]],
-            'Foo',
-            '/label',
-            '/div'
-        ];
-        $this->assertHtml($expected, $result);
+        $this->deprecated(function () {
+            $result = $this->Form->input('foo', ['nestedInput' => true]);
+            $expected = [
+                'div' => ['class' => 'input text'],
+                'label' => ['for' => 'foo'],
+                ['input' => [
+                    'type' => 'text',
+                    'name' => 'foo',
+                    'id' => 'foo'
+                ]],
+                'Foo',
+                '/label',
+                '/div'
+            ];
+            $this->assertHtml($expected, $result);
+        });
     }
 
     /**
@@ -8976,9 +8979,9 @@ class FormHelperTest extends TestCase
      *
      * @return void
      */
-    public function testInputLabelManipulationDisableLabels()
+    public function testControlLabelManipulationDisableLabels()
     {
-        $result = $this->Form->input('test', [
+        $result = $this->Form->control('test', [
             'type' => 'radio',
             'options' => ['A', 'B'],
             'labelOptions' => false
@@ -8995,7 +8998,7 @@ class FormHelperTest extends TestCase
         ];
         $this->assertHtml($expected, $result);
 
-        $result = $this->Form->input('checkbox1', [
+        $result = $this->Form->control('checkbox1', [
             'label' => 'My checkboxes',
             'multiple' => 'checkbox',
             'type' => 'select',
@@ -9032,9 +9035,9 @@ class FormHelperTest extends TestCase
      *
      * @return void
      */
-    public function testInputLabelManipulationRadios()
+    public function testControlLabelManipulationRadios()
     {
-        $result = $this->Form->input('test', [
+        $result = $this->Form->control('test', [
             'type' => 'radio',
             'options' => ['A', 'B'],
             'labelOptions' => ['class' => 'custom-class']
@@ -9057,7 +9060,7 @@ class FormHelperTest extends TestCase
         ];
         $this->assertHtml($expected, $result);
 
-        $result = $this->Form->input('test', [
+        $result = $this->Form->control('test', [
             'type' => 'radio',
             'options' => ['A', 'B'],
             'value' => 1,
@@ -9081,7 +9084,7 @@ class FormHelperTest extends TestCase
         ];
         $this->assertHtml($expected, $result);
 
-        $result = $this->Form->input('test', [
+        $result = $this->Form->control('test', [
             'type' => 'radio',
             'options' => ['A', 'B'],
             'value' => 1,
@@ -9142,9 +9145,9 @@ class FormHelperTest extends TestCase
      *
      * @return void
      */
-    public function testInputLabelManipulationCheckboxes()
+    public function testControlLabelManipulationCheckboxes()
     {
-        $result = $this->Form->input('checkbox1', [
+        $result = $this->Form->control('checkbox1', [
             'label' => 'My checkboxes',
             'multiple' => 'checkbox',
             'type' => 'select',
@@ -9194,7 +9197,7 @@ class FormHelperTest extends TestCase
         ];
         $this->assertHtml($expected, $result);
 
-        $result = $this->Form->input('checkbox1', [
+        $result = $this->Form->control('checkbox1', [
             'label' => 'My checkboxes',
             'multiple' => 'checkbox',
             'type' => 'select',

+ 227 - 209
tests/TestCase/View/Helper/HtmlHelperTest.php

@@ -1258,135 +1258,141 @@ class HtmlHelperTest extends TestCase
     /**
      * testGetCrumb and addCrumb method
      *
+     * @group deprecated
      * @return void
      */
     public function testBreadcrumb()
     {
-        $this->assertNull($this->Html->getCrumbs());
+        $this->deprecated(function () {
+            $this->assertNull($this->Html->getCrumbs());
 
-        $this->Html->addCrumb('First', '#first');
-        $this->Html->addCrumb('Second', '#second');
-        $this->Html->addCrumb('Third', '#third');
+            $this->Html->addCrumb('First', '#first');
+            $this->Html->addCrumb('Second', '#second');
+            $this->Html->addCrumb('Third', '#third');
 
-        $result = $this->Html->getCrumbs();
-        $expected = [
-            ['a' => ['href' => '#first']],
-            'First',
-            '/a',
-            '&raquo;',
-            ['a' => ['href' => '#second']],
-            'Second',
-            '/a',
-            '&raquo;',
-            ['a' => ['href' => '#third']],
-            'Third',
-            '/a',
-        ];
-        $this->assertHtml($expected, $result);
+            $result = $this->Html->getCrumbs();
+            $expected = [
+                ['a' => ['href' => '#first']],
+                'First',
+                '/a',
+                '&raquo;',
+                ['a' => ['href' => '#second']],
+                'Second',
+                '/a',
+                '&raquo;',
+                ['a' => ['href' => '#third']],
+                'Third',
+                '/a',
+            ];
+            $this->assertHtml($expected, $result);
 
-        $result = $this->Html->getCrumbs(' &gt; ');
-        $expected = [
-            ['a' => ['href' => '#first']],
-            'First',
-            '/a',
-            ' &gt; ',
-            ['a' => ['href' => '#second']],
-            'Second',
-            '/a',
-            ' &gt; ',
-            ['a' => ['href' => '#third']],
-            'Third',
-            '/a',
-        ];
-        $this->assertHtml($expected, $result);
+            $result = $this->Html->getCrumbs(' &gt; ');
+            $expected = [
+                ['a' => ['href' => '#first']],
+                'First',
+                '/a',
+                ' &gt; ',
+                ['a' => ['href' => '#second']],
+                'Second',
+                '/a',
+                ' &gt; ',
+                ['a' => ['href' => '#third']],
+                'Third',
+                '/a',
+            ];
+            $this->assertHtml($expected, $result);
 
-        $this->Html->addCrumb('Fourth', null);
+            $this->Html->addCrumb('Fourth', null);
 
-        $result = $this->Html->getCrumbs();
-        $expected = [
-            ['a' => ['href' => '#first']],
-            'First',
-            '/a',
-            '&raquo;',
-            ['a' => ['href' => '#second']],
-            'Second',
-            '/a',
-            '&raquo;',
-            ['a' => ['href' => '#third']],
-            'Third',
-            '/a',
-            '&raquo;',
-            'Fourth'
-        ];
-        $this->assertHtml($expected, $result);
+            $result = $this->Html->getCrumbs();
+            $expected = [
+                ['a' => ['href' => '#first']],
+                'First',
+                '/a',
+                '&raquo;',
+                ['a' => ['href' => '#second']],
+                'Second',
+                '/a',
+                '&raquo;',
+                ['a' => ['href' => '#third']],
+                'Third',
+                '/a',
+                '&raquo;',
+                'Fourth'
+            ];
+            $this->assertHtml($expected, $result);
 
-        $this->Html->addCrumb('Fifth', [
-            'plugin' => false,
-            'controller' => 'controller',
-            'action' => 'action',
-        ]);
-        $result = $this->Html->getCrumbs('-', 'Start');
-        $expected = [
-            ['a' => ['href' => '/']],
-            'Start',
-            '/a',
-            '-',
-            ['a' => ['href' => '#first']],
-            'First',
-            '/a',
-            '-',
-            ['a' => ['href' => '#second']],
-            'Second',
-            '/a',
-            '-',
-            ['a' => ['href' => '#third']],
-            'Third',
-            '/a',
-            '-',
-            'Fourth',
-            '-',
-            ['a' => ['href' => '/controller/action']],
-            'Fifth',
-            '/a',
-        ];
-        $this->assertHtml($expected, $result);
+            $this->Html->addCrumb('Fifth', [
+                'plugin' => false,
+                'controller' => 'controller',
+                'action' => 'action',
+            ]);
+            $result = $this->Html->getCrumbs('-', 'Start');
+            $expected = [
+                ['a' => ['href' => '/']],
+                'Start',
+                '/a',
+                '-',
+                ['a' => ['href' => '#first']],
+                'First',
+                '/a',
+                '-',
+                ['a' => ['href' => '#second']],
+                'Second',
+                '/a',
+                '-',
+                ['a' => ['href' => '#third']],
+                'Third',
+                '/a',
+                '-',
+                'Fourth',
+                '-',
+                ['a' => ['href' => '/controller/action']],
+                'Fifth',
+                '/a',
+            ];
+            $this->assertHtml($expected, $result);
+        });
     }
 
     /**
      * Test the array form of $startText
      *
+     * @group deprecated
      * @return void
      */
     public function testGetCrumbFirstLink()
     {
-        $result = $this->Html->getCrumbList([], 'Home');
-        $expected = [
-            '<ul',
-            ['li' => ['class' => 'first']],
-            ['a' => ['href' => '/']], 'Home', '/a',
-            '/li',
-            '/ul'
-        ];
-        $this->assertHtml($expected, $result);
+        $this->deprecated(function () {
+            $result = $this->Html->getCrumbList([], 'Home');
+            $expected = [
+                '<ul',
+                ['li' => ['class' => 'first']],
+                ['a' => ['href' => '/']], 'Home', '/a',
+                '/li',
+                '/ul'
+            ];
+            $this->assertHtml($expected, $result);
 
-        $this->Html->addCrumb('First', '#first');
-        $this->Html->addCrumb('Second', '#second');
+            $this->Html->addCrumb('First', '#first');
+            $this->Html->addCrumb('Second', '#second');
 
-        $result = $this->Html->getCrumbs(' - ', ['url' => '/home', 'text' => '<img src="/home.png" />', 'escape' => false]);
-        $expected = [
-            ['a' => ['href' => '/home']],
-            'img' => ['src' => '/home.png'],
-            '/a',
-            ' - ',
-            ['a' => ['href' => '#first']],
-            'First',
-            '/a',
-            ' - ',
-            ['a' => ['href' => '#second']],
-            'Second',
-            '/a',
-        ];
-        $this->assertHtml($expected, $result);
+            $result = $this->Html->getCrumbs(' - ', ['url' => '/home', 'text' => '<img src="/home.png" />', 'escape' => false]);
+            $expected = [
+                ['a' => ['href' => '/home']],
+                'img' => ['src' => '/home.png'],
+                '/a',
+                ' - ',
+                ['a' => ['href' => '#first']],
+                'First',
+                '/a',
+                ' - ',
+                ['a' => ['href' => '#second']],
+                'Second',
+                '/a',
+            ];
+            $this->assertHtml($expected, $result);
+        });
     }
 
     /**
@@ -2096,140 +2102,152 @@ class HtmlHelperTest extends TestCase
     /**
      * testCrumbList method
      *
+     * @group deprecated
      * @return void
      */
     public function testCrumbList()
     {
-        $this->assertNull($this->Html->getCrumbList());
-
-        $this->Html->addCrumb('Home', '/', ['class' => 'home']);
-        $this->Html->addCrumb('Some page', '/some_page');
-        $this->Html->addCrumb('Another page');
-        $result = $this->Html->getCrumbList(
-            ['class' => 'breadcrumbs']
-        );
-        $expected = [
-            ['ul' => ['class' => 'breadcrumbs']],
-            ['li' => ['class' => 'first']],
-            ['a' => ['class' => 'home', 'href' => '/']], 'Home', '/a',
-            '/li',
-            '<li',
-            ['a' => ['href' => '/some_page']], 'Some page', '/a',
-            '/li',
-            ['li' => ['class' => 'last']],
-            'Another page',
-            '/li',
-            '/ul'
-        ];
-        $this->assertHtml($expected, $result);
+        $this->deprecated(function () {
+            $this->assertNull($this->Html->getCrumbList());
+
+            $this->Html->addCrumb('Home', '/', ['class' => 'home']);
+            $this->Html->addCrumb('Some page', '/some_page');
+            $this->Html->addCrumb('Another page');
+            $result = $this->Html->getCrumbList(
+                ['class' => 'breadcrumbs']
+            );
+            $expected = [
+                ['ul' => ['class' => 'breadcrumbs']],
+                ['li' => ['class' => 'first']],
+                ['a' => ['class' => 'home', 'href' => '/']], 'Home', '/a',
+                '/li',
+                '<li',
+                ['a' => ['href' => '/some_page']], 'Some page', '/a',
+                '/li',
+                ['li' => ['class' => 'last']],
+                'Another page',
+                '/li',
+                '/ul'
+            ];
+            $this->assertHtml($expected, $result);
+        });
     }
 
     /**
      * Test getCrumbList startText
      *
+     * @group deprecated
      * @return void
      */
     public function testCrumbListFirstLink()
     {
-        $this->Html->addCrumb('First', '#first');
-        $this->Html->addCrumb('Second', '#second');
+        $this->deprecated(function () {
+            $this->Html->addCrumb('First', '#first');
+            $this->Html->addCrumb('Second', '#second');
 
-        $result = $this->Html->getCrumbList([], 'Home');
-        $expected = [
-            '<ul',
-            ['li' => ['class' => 'first']],
-            ['a' => ['href' => '/']], 'Home', '/a',
-            '/li',
-            '<li',
-            ['a' => ['href' => '#first']], 'First', '/a',
-            '/li',
-            ['li' => ['class' => 'last']],
-            ['a' => ['href' => '#second']], 'Second', '/a',
-            '/li',
-            '/ul'
-        ];
-        $this->assertHtml($expected, $result);
+            $result = $this->Html->getCrumbList([], 'Home');
+            $expected = [
+                '<ul',
+                ['li' => ['class' => 'first']],
+                ['a' => ['href' => '/']], 'Home', '/a',
+                '/li',
+                '<li',
+                ['a' => ['href' => '#first']], 'First', '/a',
+                '/li',
+                ['li' => ['class' => 'last']],
+                ['a' => ['href' => '#second']], 'Second', '/a',
+                '/li',
+                '/ul'
+            ];
+            $this->assertHtml($expected, $result);
 
-        $result = $this->Html->getCrumbList([], ['url' => '/home', 'text' => '<img src="/home.png" />', 'escape' => false]);
-        $expected = [
-            '<ul',
-            ['li' => ['class' => 'first']],
-            ['a' => ['href' => '/home']], 'img' => ['src' => '/home.png'], '/a',
-            '/li',
-            '<li',
-            ['a' => ['href' => '#first']], 'First', '/a',
-            '/li',
-            ['li' => ['class' => 'last']],
-            ['a' => ['href' => '#second']], 'Second', '/a',
-            '/li',
-            '/ul'
-        ];
-        $this->assertHtml($expected, $result);
+            $result = $this->Html->getCrumbList([], ['url' => '/home', 'text' => '<img src="/home.png" />', 'escape' => false]);
+            $expected = [
+                '<ul',
+                ['li' => ['class' => 'first']],
+                ['a' => ['href' => '/home']], 'img' => ['src' => '/home.png'], '/a',
+                '/li',
+                '<li',
+                ['a' => ['href' => '#first']], 'First', '/a',
+                '/li',
+                ['li' => ['class' => 'last']],
+                ['a' => ['href' => '#second']], 'Second', '/a',
+                '/li',
+                '/ul'
+            ];
+            $this->assertHtml($expected, $result);
+        });
     }
 
     /**
      * test getCrumbList() in Twitter Bootstrap style.
      *
+     * @group deprecated
      * @return void
      */
     public function testCrumbListBootstrapStyle()
     {
-        $this->Html->addCrumb('Home', '/', ['class' => 'home']);
-        $this->Html->addCrumb('Library', '/lib');
-        $this->Html->addCrumb('Data');
-        $result = $this->Html->getCrumbList([
-            'class' => 'breadcrumb',
-            'separator' => '<span class="divider">-</span>',
-            'firstClass' => false,
-            'lastClass' => 'active'
-        ]);
-        $expected = [
-            ['ul' => ['class' => 'breadcrumb']],
-            '<li',
-            ['a' => ['class' => 'home', 'href' => '/']], 'Home', '/a',
-            ['span' => ['class' => 'divider']], '-', '/span',
-            '/li',
-            '<li',
-            ['a' => ['href' => '/lib']], 'Library', '/a',
-            ['span' => ['class' => 'divider']], '-', '/span',
-            '/li',
-            ['li' => ['class' => 'active']], 'Data', '/li',
-            '/ul'
-        ];
-        $this->assertHtml($expected, $result);
+        $this->deprecated(function () {
+            $this->Html->addCrumb('Home', '/', ['class' => 'home']);
+            $this->Html->addCrumb('Library', '/lib');
+            $this->Html->addCrumb('Data');
+            $result = $this->Html->getCrumbList([
+                'class' => 'breadcrumb',
+                'separator' => '<span class="divider">-</span>',
+                'firstClass' => false,
+                'lastClass' => 'active'
+            ]);
+            $expected = [
+                ['ul' => ['class' => 'breadcrumb']],
+                '<li',
+                ['a' => ['class' => 'home', 'href' => '/']], 'Home', '/a',
+                ['span' => ['class' => 'divider']], '-', '/span',
+                '/li',
+                '<li',
+                ['a' => ['href' => '/lib']], 'Library', '/a',
+                ['span' => ['class' => 'divider']], '-', '/span',
+                '/li',
+                ['li' => ['class' => 'active']], 'Data', '/li',
+                '/ul'
+            ];
+            $this->assertHtml($expected, $result);
+        });
     }
 
     /**
      * Test GetCrumbList using style of Zurb Foundation.
      *
+     * @group deprecated
      * @return void
      */
     public function testCrumbListZurbStyle()
     {
-        $this->Html->addCrumb('Home', '#');
-        $this->Html->addCrumb('Features', '#');
-        $this->Html->addCrumb('Gene Splicing', '#');
-        $this->Html->addCrumb('Home', '#');
-        $result = $this->Html->getCrumbList(
-            ['class' => 'breadcrumbs', 'firstClass' => false, 'lastClass' => 'current']
-        );
-        $expected = [
-            ['ul' => ['class' => 'breadcrumbs']],
-            '<li',
-            ['a' => ['href' => '#']], 'Home', '/a',
-            '/li',
-            '<li',
-            ['a' => ['href' => '#']], 'Features', '/a',
-            '/li',
-            '<li',
-            ['a' => ['href' => '#']], 'Gene Splicing', '/a',
-            '/li',
-            ['li' => ['class' => 'current']],
-            ['a' => ['href' => '#']], 'Home', '/a',
-            '/li',
-            '/ul'
-        ];
-        $this->assertHtml($expected, $result, true);
+        $this->deprecated(function () {
+            $this->Html->addCrumb('Home', '#');
+            $this->Html->addCrumb('Features', '#');
+            $this->Html->addCrumb('Gene Splicing', '#');
+            $this->Html->addCrumb('Home', '#');
+            $result = $this->Html->getCrumbList(
+                ['class' => 'breadcrumbs', 'firstClass' => false, 'lastClass' => 'current']
+            );
+            $expected = [
+                ['ul' => ['class' => 'breadcrumbs']],
+                '<li',
+                ['a' => ['href' => '#']], 'Home', '/a',
+                '/li',
+                '<li',
+                ['a' => ['href' => '#']], 'Features', '/a',
+                '/li',
+                '<li',
+                ['a' => ['href' => '#']], 'Gene Splicing', '/a',
+                '/li',
+                ['li' => ['class' => 'current']],
+                ['a' => ['href' => '#']], 'Home', '/a',
+                '/li',
+                '/ul'
+            ];
+            $this->assertHtml($expected, $result, true);
+        });
     }
 
     /**

+ 3 - 3
tests/TestCase/View/Helper/PaginatorHelperTest.php

@@ -98,7 +98,7 @@ class PaginatorHelperTest extends TestCase
      */
     public function testTemplates()
     {
-        $result = $this->Paginator->templates([
+        $result = $this->Paginator->setTemplates([
             'test' => 'val'
         ]);
         $this->assertSame(
@@ -107,11 +107,11 @@ class PaginatorHelperTest extends TestCase
             'Setting should return the same object'
         );
 
-        $result = $this->Paginator->templates();
+        $result = $this->Paginator->getTemplates();
         $this->assertArrayHasKey('test', $result);
         $this->assertEquals('val', $result['test']);
 
-        $this->assertEquals('val', $this->Paginator->templates('test'));
+        $this->assertEquals('val', $this->Paginator->getTemplates('test'));
     }
 
     /**

+ 1 - 1
tests/TestCase/View/JsonViewTest.php

@@ -332,7 +332,7 @@ class JsonViewTest extends TestCase
         $Controller->set('user', $data);
         $Controller->viewBuilder()->setClassName('Json');
         $View = $Controller->createView();
-        $View->viewPath = $Controller->name;
+        $View->setTemplatePath($Controller->name);
         $output = $View->render('index');
 
         $expected = json_encode(['user' => 'fake', 'list' => ['item1', 'item2'], 'paging' => null]);

+ 4 - 4
tests/TestCase/View/ViewBuilderTest.php

@@ -129,10 +129,10 @@ class ViewBuilderTest extends TestCase
             $events
         );
         $this->assertInstanceOf('Cake\View\AjaxView', $view);
-        $this->assertEquals('edit', $view->view);
-        $this->assertEquals('default', $view->layout);
-        $this->assertEquals('Articles/', $view->viewPath);
-        $this->assertEquals('Admin/', $view->layoutPath);
+        $this->assertEquals('edit', $view->getTemplate());
+        $this->assertEquals('default', $view->getLayout());
+        $this->assertEquals('Articles/', $view->getTemplatePath());
+        $this->assertEquals('Admin/', $view->getLayoutPath());
         $this->assertEquals('TestPlugin', $view->plugin);
         $this->assertEquals('TestTheme', $view->theme);
         $this->assertSame($request, $view->request);

+ 31 - 27
tests/TestCase/View/ViewTest.php

@@ -303,14 +303,14 @@ class ViewTest extends TestCase
         $this->PostsController = new ViewPostsController($request);
         $this->PostsController->index();
         $this->View = $this->PostsController->createView();
-        $this->View->viewPath = 'Posts';
+        $this->View->setTemplatePath('Posts');
 
         $themeRequest = new ServerRequest('posts/index');
         $this->ThemeController = new Controller($themeRequest);
         $this->ThemePostsController = new ThemePostsController($themeRequest);
         $this->ThemePostsController->index();
         $this->ThemeView = $this->ThemePostsController->createView();
-        $this->ThemeView->viewPath = 'Posts';
+        $this->ThemeView->setTemplatePath('Posts');
 
         Plugin::load(['TestPlugin', 'PluginJs', 'TestTheme', 'Company/TestPluginThree']);
         Configure::write('debug', true);
@@ -622,7 +622,7 @@ class ViewTest extends TestCase
         $result = $View->getViewFileName('TestPlugin.home');
         $this->assertPathEquals($expected, $result, 'Plugin is missing the view, cascade to app.');
 
-        $View->templatePath('Tests');
+        $View->setTemplatePath('Tests');
         $expected = TEST_APP . 'Plugin' . DS . 'TestPlugin' . DS . 'src' . DS .
             'Template' . DS . 'Tests' . DS . 'index.ctp';
         $result = $View->getViewFileName('TestPlugin.index');
@@ -1044,8 +1044,8 @@ class ViewTest extends TestCase
     public function testViewEvent()
     {
         $View = $this->PostsController->createView();
-        $View->templatePath($this->PostsController->name);
-        $View->autoLayout = false;
+        $View->setTemplatePath($this->PostsController->name);
+        $View->enableAutoLayout(false);
         $listener = new TestViewEventListenerInterface();
 
         $View->getEventManager()->on($listener);
@@ -1153,7 +1153,7 @@ class ViewTest extends TestCase
     public function testHelperCallbackTriggering()
     {
         $View = $this->PostsController->createView();
-        $View->templatePath($this->PostsController->name);
+        $View->setTemplatePath($this->PostsController->name);
 
         $manager = $this->getMockBuilder('Cake\Event\EventManager')->getMock();
         $View->setEventManager($manager);
@@ -1245,7 +1245,7 @@ class ViewTest extends TestCase
             'Html'
         ];
         $View = $this->PostsController->createView();
-        $View->templatePath($this->PostsController->name);
+        $View->setTemplatePath($this->PostsController->name);
         $View->render('index');
         $this->assertEquals('Valuation', $View->helpers()->TestBeforeAfter->property);
     }
@@ -1264,7 +1264,7 @@ class ViewTest extends TestCase
         $this->PostsController->set('variable', 'values');
 
         $View = $this->PostsController->createView();
-        $View->templatePath($this->PostsController->name);
+        $View->setTemplatePath($this->PostsController->name);
 
         $content = 'This is my view output';
         $result = $View->renderLayout($content, 'default');
@@ -1281,7 +1281,7 @@ class ViewTest extends TestCase
     {
         $this->PostsController->helpers = ['Form', 'Number'];
         $View = $this->PostsController->createView('Cake\Test\TestCase\View\TestView');
-        $View->templatePath($this->PostsController->name);
+        $View->setTemplatePath($this->PostsController->name);
 
         $result = $View->render('index', false);
         $this->assertEquals('posts index', $result);
@@ -1292,7 +1292,7 @@ class ViewTest extends TestCase
 
         $this->PostsController->helpers = ['Html', 'Form', 'Number', 'TestPlugin.PluggedHelper'];
         $View = $this->PostsController->createView('Cake\Test\TestCase\View\TestView');
-        $View->templatePath($this->PostsController->name);
+        $View->setTemplatePath($this->PostsController->name);
 
         $result = $View->render('index', false);
         $this->assertEquals('posts index', $result);
@@ -1310,7 +1310,7 @@ class ViewTest extends TestCase
     public function testRender()
     {
         $View = $this->PostsController->createView('Cake\Test\TestCase\View\TestView');
-        $View->templatePath($this->PostsController->name);
+        $View->setTemplatePath($this->PostsController->name);
         $result = $View->render('index');
 
         $this->assertRegExp("/<meta charset=\"utf-8\"\/>\s*<title>/", $result);
@@ -1329,7 +1329,7 @@ class ViewTest extends TestCase
         Configure::write('Cache.check', true);
 
         $View = $this->PostsController->createView('Cake\Test\TestCase\View\TestView');
-        $View->templatePath($this->PostsController->name);
+        $View->setTemplatePath($this->PostsController->name);
         $result = $View->render('index');
 
         $this->assertRegExp("/<meta charset=\"utf-8\"\/>\s*<title>/", $result);
@@ -1344,10 +1344,10 @@ class ViewTest extends TestCase
     public function testRenderUsingViewProperty()
     {
         $View = $this->PostsController->createView('Cake\Test\TestCase\View\TestView');
-        $View->templatePath($this->PostsController->name);
-        $View->template('cache_form');
+        $View->setTemplatePath($this->PostsController->name);
+        $View->setTemplate('cache_form');
 
-        $this->assertEquals('cache_form', $View->view);
+        $this->assertEquals('cache_form', $View->getTemplate());
         $result = $View->render();
         $this->assertRegExp('/Add User/', $result);
     }
@@ -1366,7 +1366,7 @@ class ViewTest extends TestCase
 
         $View = $this->PostsController->createView('Cake\Test\TestCase\View\TestView');
         $View->set(compact('error', 'message'));
-        $View->viewPath = 'Error';
+        $View->setTemplatePath('Error');
 
         $result = $View->render('pdo_error', 'error');
         $this->assertRegExp('/this is sql string/', $result);
@@ -1384,7 +1384,8 @@ class ViewTest extends TestCase
         $this->PostsController->plugin = 'TestPlugin';
         $this->PostsController->name = 'Posts';
         $View = $this->PostsController->createView('Cake\Test\TestCase\View\TestView');
-        $View->templatePath('Element');
+        $View->setTemplatePath('Element');
+
         $pluginPath = TEST_APP . 'Plugin' . DS . 'TestPlugin' . DS;
         $result = $View->getViewFileName('sub_dir/sub_element');
         $expected = $pluginPath . 'src' . DS . 'Template' . DS . 'Element' . DS . 'sub_dir' . DS . 'sub_element.ctp';
@@ -1403,7 +1404,7 @@ class ViewTest extends TestCase
         $Controller->helpers = ['Html'];
         $Controller->set('html', 'I am some test html');
         $View = $Controller->createView();
-        $View->templatePath($Controller->name);
+        $View->setTemplatePath($Controller->name);
         $result = $View->render('helper_overwrite', false);
 
         $this->assertRegExp('/I am some test html/', $result);
@@ -1418,7 +1419,7 @@ class ViewTest extends TestCase
     public function testViewFileName()
     {
         $View = $this->PostsController->createView('Cake\Test\TestCase\View\TestView');
-        $View->templatePath('Posts');
+        $View->setTemplatePath('Posts');
 
         $result = $View->getViewFileName('index');
         $this->assertRegExp('/Posts(\/|\\\)index.ctp/', $result);
@@ -1950,7 +1951,7 @@ TEXT;
         $this->ThemeController->name = 'Posts';
 
         $View = $this->ThemeController->createView();
-        $View->templatePath('Posts');
+        $View->setTemplatePath('Posts');
         $View->layout = 'whatever';
         $View->theme = 'TestTheme';
         $View->element('test_element');
@@ -2101,18 +2102,21 @@ TEXT;
     /**
      * Test magic getter and setter for removed properties.
      *
+     * @group deprecated
      * @return void
      */
     public function testMagicGetterSetter()
     {
-        $View = $this->View;
+        $this->deprecated(function () {
+            $View = $this->View;
 
-        $View->view = 'myview';
-        $this->assertEquals('myview', $View->template());
-        $this->assertEquals('myview', $View->view);
+            $View->view = 'myview';
+            $this->assertEquals('myview', $View->template());
+            $this->assertEquals('myview', $View->view);
 
-        $View->viewPath = 'mypath';
-        $this->assertEquals('mypath', $View->templatePath());
-        $this->assertEquals('mypath', $View->templatePath);
+            $View->viewPath = 'mypath';
+            $this->assertEquals('mypath', $View->templatePath());
+            $this->assertEquals('mypath', $View->templatePath);
+        });
     }
 }

+ 1 - 1
tests/TestCase/View/XmlViewTest.php

@@ -298,7 +298,7 @@ class XmlViewTest extends TestCase
         $Controller->set('users', $data);
         $Controller->viewClass = 'Xml';
         $View = $Controller->createView();
-        $View->viewPath = 'Posts';
+        $View->setTemplatePath('Posts');
         $output = $View->render('index');
 
         $expected = [