Subversion Repositories SmartDukaan

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
13532 anikendra 1
<?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
	public function add() {
31
		$data = array(
32
			'Post' => array(
33
				'title' => 'Test article',
34
				'body' => 'Body of article.',
35
				'author_id' => 1
36
			)
37
		);
38
		$this->Post->save($data);
39
 
40
		$this->set('posts', $this->Post->find('all'));
41
		$this->render('index');
42
	}
43
 
44
/**
45
 * check URL params
46
 *
47
 */
48
	public function url_var() {
49
		$this->set('params', $this->request->params);
50
		$this->render('index');
51
	}
52
 
53
/**
54
 * post var testing
55
 *
56
 */
57
	public function post_var() {
58
		$this->set('data', $this->request->data);
59
		$this->render('index');
60
	}
61
 
62
	public function input_data() {
63
		$this->set('data', $this->request->input('json_decode', true));
64
		$this->render('index');
65
	}
66
 
67
/**
68
 * Fixturized action for testAction()
69
 *
70
 */
71
	public function fixtured() {
72
		$this->set('posts', $this->Post->find('all'));
73
		$this->render('index');
74
	}
75
 
76
}