I've tried searching the new docs about testing with the new PHPUnit
for CakePHP 2.0 Beta, without any success
Below is my code for testing the admin action of controller posts with
method add.
My issue is that I expected from the docs I received that headers were
set when using testAction, it is always blank
public function testAdminAdd() {
$Posts = $this->generate('Posts', array(
'components' => array(
'Session'
)
)
);
$Posts->Session->expects($this->once())-
>method('setFlash');
$this->testAction('/admin/posts/add', array(
'data' => array(
'Post' => array('name' => 'New Post')
)
)
);
// debug($this);
$this->assertEquals($this->headers['Location'], '/admin/
posts/index');
$this->assertEquals($this->vars['post']['Post']['name'],
'New Post');
$this->assertPattern('/<html/', $this->contents);
$this->assertPattern('/<form/', $this->view);
--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
No comments:
Post a Comment