Created
December 17, 2013 21:16
-
-
Save raisen/8012741 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// controller | |
class MediaController extends AppController { | |
private $foreign_id, $model, $user_id; | |
public $components = array('Paginator', 'RequestHandler', | |
'Crud.Crud' => array( | |
'actions' => array( | |
'create' => 'Crud.add', | |
), | |
'listeners' => array( | |
'Crud.Api', | |
'Crud.ApiPagination', | |
'Crud.ApiQueryLog', | |
) | |
) | |
); | |
function create() { | |
return $this->Crud->execute(); | |
} | |
// test | |
class MediaControllerTest extends ControllerTestCase { | |
public $fixtures = array('app.media', 'app.user', 'app.user_activity'); | |
public function testMediaCreate() { | |
$this->controller = $this->generate('Media', array( | |
'components' => array('Auth') | |
)); | |
$this->controller->Auth->staticExpects($this->any()) | |
->method('user') | |
->with('id') | |
->will($this->returnValue(1)); | |
$result = $this->testAction('/user/media/create', array('return' => 'contents')); | |
debug($result); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment