SimpleTest assertTags - loose matching? (for CakePHP)
Posted
by Arkaaito
on Stack Overflow
See other posts from Stack Overflow
or by Arkaaito
Published on 2010-06-17T00:08:59Z
Indexed on
2010/06/17
0:12 UTC
Read the original article
Hit count: 201
I'd like to use SimpleTest to set up some functionality tests for our project - in particular, we have a very busy page which has some random components and some static components, and I'd like to be able to write a simple test which only confirms the static bits (preferably only the one or two most important ones). In other words, I want to be able to leave out any tags on the page I don't care about, and write something like:
$result = "<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head><title>...</title><meta .../></head><body><script type="text/javascript">...</script><div class="center-splash"><span>Welcome JohnDoe</span><p>Your progress:</p>...</div><div class="left-column">...</div><div class="right-column">...</div>...</body></html>";
$expects = array('html'=>true,'body'=>true,'div'=>array('class'=>'center_splash'),'span'=>true,'Welcome JohnDoe','/span','/div','/body','/html');
$this->assertTagsButIgnoreExtras($result, $expects);
When I try this with assertTags it fails. Is there a version of assertTags which allows this - something either officially part of the SimpleTest or CakePHP project or unofficially put out under the MIT license or similar?
© Stack Overflow or respective owner