Did you ever figure this out? My $this->header is always returning an empty array an empty array as well, I've been stuck on this for a couple days now.. Please help me if you figured this out
On Thursday, August 25, 2011 12:33:08 AM UTC-5, Christophe Roblin wrote: > > No, $this->headers seems to always return an empty array > > On 25 Aug, 06:02, jeremyharris <[email protected]> wrote: > > When you debug the $this->headers var, what do you get back? Anything > > at all? > > > > If you're not getting anything back then it might be a problem with > > testAction, although there are tests that show it works. > > > > On Aug 21, 1:48 am, Christophe Roblin <[email protected]> wrote: > > > > > > > > > > > > > > > > > Hi, > > > > > 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 [email protected] For more options, visit this group at http://groups.google.com/group/cake-php
