Skip to content

Commit

Permalink
Update Scaffold view tests.
Browse files Browse the repository at this point in the history
Remove tests for Admin scaffolding, as prefixes are now their own
classes which can be scaffolded independently.
  • Loading branch information
markstory committed Oct 7, 2012
1 parent 7fd727b commit f747fd3
Show file tree
Hide file tree
Showing 3 changed files with 190 additions and 199 deletions.
38 changes: 38 additions & 0 deletions lib/Cake/Test/TestApp/Controller/ScaffoldArticlesController.php
@@ -0,0 +1,38 @@
<?php
/**
* CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @since CakePHP(tm) v 3.0
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
namespace TestApp\Controller;

use Cake\Controller\Controller;

/**
* ScaffoldArticlesController class
*
* @package TestApp.Controller
*/
class ScaffoldArticlesController extends Controller {

/**
* name property
*
* @var string
*/
public $name = 'Articles';

/**
* scaffold property
*
* @var mixed
*/
public $scaffold;
}
93 changes: 93 additions & 0 deletions lib/Cake/Test/TestApp/Model/Article.php
@@ -0,0 +1,93 @@
<?php
/**
* CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @since CakePHP(tm) v 3.0
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
namespace TestApp\Model;

use Cake\TestSuite\Fixture\TestModel;

/**
* Article class
*
* @package TestApp.Model
*/
class Article extends TestModel {

/**
* name property
*
* @var string 'Article'
*/
public $name = 'Article';

/**
* belongsTo property
*
* @var array
*/
public $belongsTo = array('User');

/**
* hasMany property
*
* @var array
*/
public $hasMany = array('Comment' => array('dependent' => true));

/**
* hasAndBelongsToMany property
*
* @var array
*/
public $hasAndBelongsToMany = array('Tag');

/**
* validate property
*
* @var array
*/
public $validate = array(
'user_id' => 'numeric',
'title' => array('required' => false, 'rule' => 'notEmpty'),
'body' => array('required' => false, 'rule' => 'notEmpty'),
);

/**
* beforeSaveReturn property
*
* @var bool true
*/
public $beforeSaveReturn = true;

/**
* beforeSave method
*
* @return void
*/
public function beforeSave($options = array()) {
return $this->beforeSaveReturn;
}

/**
* titleDuplicate method
*
* @param string $title
* @return void
*/
public static function titleDuplicate($title) {
if ($title === 'My Article Title') {
return false;
}
return true;
}

}

0 comments on commit f747fd3

Please sign in to comment.