Skip to content
Permalink
Browse files

Update test case View folder

  • Loading branch information...
jrbasso committed May 26, 2012
1 parent 773ce02 commit d1847a1aa6c212b532d3a0828bbe6fd386ec0d85
@@ -16,11 +16,17 @@
* @since CakePHP(tm) v 1.2.0.4206
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
App::uses('Controller', 'Controller');
App::uses('Model', 'Model');
App::uses('View', 'View');
App::uses('CacheHelper', 'View/Helper');
namespace Cake\Test\TestCase\View\Helper;
use Cake\TestSuite\TestCase,
Cake\Controller\Controller,
Cake\Model\Model,
Cake\View\View,
Cake\View\Helper\CacheHelper,
Cake\Core\App,
Cake\Core\Configure,
Cake\Routing\Router,
Cake\Network\Request;
/**
* CacheTestController class
@@ -57,7 +63,7 @@ public function cache_parsing() {
*
* @package Cake.Test.Case.View.Helper
*/
class CacheHelperTest extends CakeTestCase {
class CacheHelperTest extends TestCase {
/**
* Checks if TMP/views is writable, and skips the case if it is not.
@@ -78,14 +84,14 @@ public function skip() {
public function setUp() {
parent::setUp();
$_GET = array();
$request = new CakeRequest();
$request = new Request();
$this->Controller = new CacheTestController($request);
$View = new View($this->Controller);
$this->Cache = new CacheHelper($View);
Configure::write('Cache.check', true);
Configure::write('Cache.disable', false);
App::build(array(
'View' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS)
'View' => array(CAKE . 'Test' . DS . 'TestApp' . DS . 'View' . DS)
), App::RESET);
}
@@ -555,7 +561,7 @@ public function testAfterRenderConditions() {
$View->cacheAction = '+1 day';
$View->output = 'test';
$Cache = $this->getMock('CacheHelper', array('_parseContent'), array($View));
$Cache = $this->getMock('Cake\View\Helper\CacheHelper', array('_parseContent'), array($View));
$Cache->expects($this->once())
->method('_parseContent')
->with('posts/index', 'content')
@@ -582,7 +588,7 @@ public function testAfterLayoutConditions() {
$View->cacheAction = '+1 day';
$View->output = 'test';
$Cache = $this->getMock('CacheHelper', array('cache'), array($View));
$Cache = $this->getMock('Cake\View\Helper\CacheHelper', array('cache'), array($View));
$Cache->expects($this->once())
->method('cache')
->with('posts/index', $View->output)
@@ -16,15 +16,22 @@
* @since CakePHP(tm) v 1.2.0.4206
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
App::uses('ClassRegistry', 'Utility');
App::uses('Controller', 'Controller');
App::uses('View', 'View');
App::uses('Model', 'Model');
App::uses('Security', 'Utility');
App::uses('CakeRequest', 'Network');
App::uses('HtmlHelper', 'View/Helper');
App::uses('FormHelper', 'View/Helper');
App::uses('Router', 'Routing');
namespace Cake\Test\TestCase\View\Helper;
use Cake\TestSuite\TestCase,
Cake\TestSuite\Fixture\TestModel,
Cake\Controller\Controller,
Cake\Model\Model,
Cake\View\View,
Cake\View\Helper\FormHelper,
Cake\View\Helper\HtmlHelper,
Cake\Core\App,
Cake\Core\Plugin,
Cake\Core\Configure,
Cake\Routing\Router,
Cake\Network\Request,
Cake\Utility\ClassRegistry,
Cake\Utility\Security;
/**
* ContactTestController class
@@ -55,7 +62,7 @@ class ContactTestController extends Controller {
* @package cake
* @package Cake.Test.Case.View.Helper
*/
class Contact extends CakeTestModel {
class Contact extends TestModel {
/**
* primaryKey property
@@ -136,14 +143,21 @@ public function setSchema($schema) {
*
* @var array
*/
public $hasAndBelongsToMany = array('ContactTag' => array('with' => 'ContactTagsContact'));
public $hasAndBelongsToMany = array(
'ContactTag' => array(
'className' => 'Cake\Test\TestCase\View\Helper\ContactTag',
'with' => 'Cake\Test\TestCase\View\Helper\ContactTagsContact'
)
);
/**
* hasAndBelongsToMany property
*
* @var array
*/
public $belongsTo = array('User' => array('className' => 'UserForm'));
public $belongsTo = array(
'User' => array('className' => 'UserForm'
));
}
/**
@@ -152,7 +166,7 @@ public function setSchema($schema) {
* @package cake
* @package Cake.Test.Case.View.Helper
*/
class ContactTagsContact extends CakeTestModel {
class ContactTagsContact extends TestModel {
/**
* useTable property
@@ -261,7 +275,7 @@ class ContactTag extends Model {
* @package cake
* @package Cake.Test.Case.View.Helper
*/
class UserForm extends CakeTestModel {
class UserForm extends TestModel {
/**
* useTable property
@@ -316,7 +330,7 @@ class UserForm extends CakeTestModel {
* @package cake
* @package Cake.Test.Case.View.Helper
*/
class OpenidUrl extends CakeTestModel {
class OpenidUrl extends TestModel {
/**
* useTable property
@@ -386,7 +400,7 @@ public function beforeValidate($options = array()) {
* @package cake
* @package Cake.Test.Case.View.Helper
*/
class ValidateUser extends CakeTestModel {
class ValidateUser extends TestModel {
/**
* primaryKey property
@@ -450,7 +464,7 @@ public function beforeValidate($options = array()) {
* @package cake
* @package Cake.Test.Case.View.Helper
*/
class ValidateProfile extends CakeTestModel {
class ValidateProfile extends TestModel {
/**
* primaryKey property
@@ -524,7 +538,7 @@ public function beforeValidate($options = array()) {
* @package cake
* @package Cake.Test.Case.View.Helper
*/
class ValidateItem extends CakeTestModel {
class ValidateItem extends TestModel {
/**
* primaryKey property
@@ -588,7 +602,7 @@ public function beforeValidate($options = array()) {
* @package cake
* @package Cake.Test.Case.View.Helper
*/
class TestMail extends CakeTestModel {
class TestMail extends TestModel {
/**
* primaryKey property
@@ -619,7 +633,7 @@ class TestMail extends CakeTestModel {
* @subpackage Cake.Test.Case.View.Helper
* @property FormHelper $Form
*/
class FormHelperTest extends CakeTestCase {
class FormHelperTest extends TestCase {
/**
* Fixtures to be used
@@ -644,12 +658,14 @@ public function setUp() {
parent::setUp();
Configure::write('App.base', '');
Configure::write('App.namespace', 'Cake\Test\TestCase\View\Helper');
$this->Controller = new ContactTestController();
$this->View = new View($this->Controller);
$this->Form = new FormHelper($this->View);
$this->Form->Html = new HtmlHelper($this->View);
$this->Form->request = new CakeRequest('contacts/add', false);
$this->Form->request = new Request('contacts/add', false);
$this->Form->request->here = '/contacts/add';
$this->Form->request['action'] = 'add';
$this->Form->request->webroot = '';
@@ -2624,7 +2640,7 @@ public function testInputWithMatchingFieldAndModelName() {
* @return void
*/
public function testFormInputs() {
$this->Form->create('Contact');
$this->Form->create('Cake\Test\TestCase\View\Helper\Contact');
$result = $this->Form->inputs('The Legend');
$expected = array(
'<fieldset',
@@ -7770,7 +7786,7 @@ public function testHtml5Inputs() {
/**
*
* @expectedException CakeException
* @expectedException Cake\Error\Exception
* @return void
*/
public function testHtml5InputException() {
@@ -7785,17 +7801,22 @@ public function testHtml5InputException() {
public function testIntrospectModelFromRequest() {
$this->loadFixtures('Post');
App::build(array(
'Plugin' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS)
'Plugin' => array(CAKE . 'Test' . DS . 'TestApp' . DS . 'Plugin' . DS)
));
CakePlugin::load('TestPlugin');
$this->Form->request['models'] = array('TestPluginPost' => array('plugin' => 'TestPlugin', 'className' => 'TestPluginPost'));
Plugin::load('TestPlugin');
$this->Form->request['models'] = array(
'TestPluginPost' => array(
'plugin' => 'TestPlugin',
'className' => 'TestPluginPost'
)
);
$this->assertFalse(ClassRegistry::isKeySet('TestPluginPost'));
$this->Form->create('TestPluginPost');
$this->assertTrue(ClassRegistry::isKeySet('TestPluginPost'));
$this->assertInstanceOf('TestPluginPost', ClassRegistry::getObject('TestPluginPost'));
$this->assertInstanceOf('TestPlugin\Model\TestPluginPost', ClassRegistry::getObject('TestPluginPost'));
CakePlugin::unload();
Plugin::unload();
App::build();
}
Oops, something went wrong.

0 comments on commit d1847a1

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