Re: assertTags method interprets line breaks in my views and breaks test
I figured it out. It was because I had it indented inside of a php
block foreach loop. If I keep it on the same level as the php loop
code thats around it, the tests work fine.
Here's what I originally had that was causing the error:
<?php foreach(): ?>
<p>
<a href="index">User 1</a>
</p>
<?php endforeach; ?>
This is how it should be, no indentation inside the php loop:
<?php foreach(): ?>
<p>
<a href="index">User 1</a>
</p>
<?php endforeach; ?>
On Oct 7, 10:24 pm, andrewperk <andrewp...@gmail.com> wrote:
> How can I test my view's html that have formatting(line breaks,
> indenting) using assertTags? Here's the problem I'm running to:
>
> When I create html like this inside one of my views:
>
> <p>
> <a href="index">User 1</a>
> </p>
>
> And then run the assertTags method like so:
>
> $this->assertTags($result, array(
> 'p'=>array(),
> 'a'=>array('href'=>'index'),
> 'User 1',
> '/a',
> '/p'
> ));
>
> This will fail because of the line breaks in the html. If I change my
> html to have zero linebreaks, all on one line:
>
> <p><a href="index">User 1</a></p>
>
> It passes just fine.
>
> Do I need to somehow include these line breaks in my assertion? I
> don't know how to do this.
>
> Thanks for any help.
--
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
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home