Skip to content
Permalink
Browse files

Fix mistakes of replacing combined getters/setters

  • Loading branch information...
chinpei215 committed Jan 30, 2017
1 parent ab29b5b commit 04c4d93c2edf0d9d8d6e39d8b1a82b3db57723eb
@@ -118,11 +118,11 @@ protected function _createCell($className, $action, $plugin, $options)
}
if (method_exists($this, 'viewBuilder')) {
$builder->setTheme($this->viewBuilder()->theme());
$builder->setTheme($this->viewBuilder()->getTheme());
}
if (isset($this->viewClass)) {
$builder->getClassName($this->viewClass);
$builder->setClassName($this->viewClass);
$instance->viewClass = $this->viewClass;
}
@@ -19,6 +19,7 @@
use Cake\Core\Plugin;
use Cake\TestSuite\TestCase;
use Cake\View\View;
use TestApp\Controller\CellTraitTestController;
use TestApp\View\CustomJsonView;
/**
@@ -353,8 +354,29 @@ public function testCellInheritsCustomViewClass()
$request = $this->getMockBuilder('Cake\Network\Request')->getMock();
$response = $this->getMockBuilder('Cake\Network\Response')->getMock();
$view = new CustomJsonView($request, $response);
$view->theme = 'Pretty';
$cell = $view->cell('Articles');
$this->assertSame('TestApp\View\CustomJsonView', $cell->viewClass);
$this->assertSame('TestApp\View\CustomJsonView', $cell->viewBuilder()->getClassName());
$this->assertSame('Pretty', $cell->viewBuilder()->getTheme());
}
/**
* Test that cells the view class name of a controller passed on.
*
* @return void
*/
public function testCellInheritsController()
{
$request = $this->getMockBuilder('Cake\Network\Request')->getMock();
$response = $this->getMockBuilder('Cake\Network\Response')->getMock();
$controller = new CellTraitTestController($request, $response);
$controller->viewBuilder()->setTheme('Pretty');
$controller->viewClass = 'Json';
$cell = $controller->cell('Articles');
$this->assertSame('Json', $cell->viewClass);
$this->assertSame('Json', $cell->viewBuilder()->getClassName());
$this->assertSame('Pretty', $cell->viewBuilder()->getTheme());
}
/**
@@ -0,0 +1,28 @@
<?php
/**
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* 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://cakephp.org CakePHP(tm) Project
* @since 3.4.0
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
namespace TestApp\Controller;
use Cake\Controller\Controller;
use Cake\View\CellTrait;
/**
* CellTraitTestController class.
*/
class CellTraitTestController extends Controller
{
use CellTrait {
cell as public;
}
}

0 comments on commit 04c4d93

Please sign in to comment.
You can’t perform that action at this time.