pictcode / lib / Cake / Test / test_app / Controller / TestsAppsPostsController.php @ 9d2f0219
履歴 | 表示 | アノテート | ダウンロード (1.869 KB)
| 1 | 635eef61 | spyder1211 | <?php
|
|---|---|---|---|
| 2 | /**
|
||
| 3 | * TestsAppsPostsController file
|
||
| 4 | *
|
||
| 5 | * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
|
||
| 6 | * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||
| 7 | *
|
||
| 8 | * Licensed under The MIT License
|
||
| 9 | * For full copyright and license information, please see the LICENSE.txt
|
||
| 10 | * Redistributions of files must retain the above copyright notice
|
||
| 11 | *
|
||
| 12 | * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||
| 13 | * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
|
||
| 14 | * @package Cake.Test.TestApp.Controller
|
||
| 15 | * @since CakePHP(tm) v 1.2.0.4206
|
||
| 16 | * @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||
| 17 | */
|
||
| 18 | |||
| 19 | /**
|
||
| 20 | * Class TestsAppsPostsController
|
||
| 21 | *
|
||
| 22 | * @package Cake.Test.TestApp.Controller
|
||
| 23 | */
|
||
| 24 | class TestsAppsPostsController extends AppController { |
||
| 25 | |||
| 26 | public $uses = array('Post'); |
||
| 27 | |||
| 28 | public $viewPath = 'TestsApps'; |
||
| 29 | |||
| 30 | /**
|
||
| 31 | * add method
|
||
| 32 | *
|
||
| 33 | * @return void
|
||
| 34 | */
|
||
| 35 | public function add() { |
||
| 36 | $data = array( |
||
| 37 | 'Post' => array( |
||
| 38 | 'title' => 'Test article', |
||
| 39 | 'body' => 'Body of article.', |
||
| 40 | 'author_id' => 1 |
||
| 41 | ) |
||
| 42 | ); |
||
| 43 | $this->Post->save($data); |
||
| 44 | |||
| 45 | $this->set('posts', $this->Post->find('all')); |
||
| 46 | $this->render('index'); |
||
| 47 | } |
||
| 48 | |||
| 49 | /**
|
||
| 50 | * check URL params
|
||
| 51 | *
|
||
| 52 | * @return void
|
||
| 53 | */
|
||
| 54 | public function url_var() { |
||
| 55 | $this->set('params', $this->request->params); |
||
| 56 | $this->render('index'); |
||
| 57 | } |
||
| 58 | |||
| 59 | /**
|
||
| 60 | * post var testing
|
||
| 61 | *
|
||
| 62 | * @return void
|
||
| 63 | */
|
||
| 64 | public function post_var() { |
||
| 65 | $this->set('data', $this->request->data); |
||
| 66 | $this->render('index'); |
||
| 67 | } |
||
| 68 | |||
| 69 | /**
|
||
| 70 | * input_data()
|
||
| 71 | *
|
||
| 72 | * @return void
|
||
| 73 | */
|
||
| 74 | public function input_data() { |
||
| 75 | $this->set('data', $this->request->input('json_decode', true)); |
||
| 76 | $this->render('index'); |
||
| 77 | } |
||
| 78 | |||
| 79 | /**
|
||
| 80 | * Fixturized action for testAction()
|
||
| 81 | *
|
||
| 82 | * @return void
|
||
| 83 | */
|
||
| 84 | public function fixtured() { |
||
| 85 | $this->set('posts', $this->Post->find('all')); |
||
| 86 | $this->render('index'); |
||
| 87 | } |
||
| 88 | |||
| 89 | } |