<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Recent changes to 201: assertLink by href value</title><link>https://sourceforge.net/p/simpletest/bugs/201/</link><description>Recent changes to 201: assertLink by href value</description><atom:link href="https://sourceforge.net/p/simpletest/bugs/201/feed.rss" rel="self"/><language>en</language><lastBuildDate>Wed, 03 Nov 2010 08:32:00 -0000</lastBuildDate><atom:link href="https://sourceforge.net/p/simpletest/bugs/201/feed.rss" rel="self" type="application/rss+xml"/><item><title>assertLink by href value</title><link>https://sourceforge.net/p/simpletest/bugs/201/</link><description>&lt;div class="markdown_content"&gt;&lt;p&gt;assertLink check only one (first) link, selected by label. If page have 2,3,4,... links with indentical text, but witdth different "href", we can`t check all this links.&lt;/p&gt;
&lt;p&gt;my variant WebTestCase::assertLink() method:&lt;/p&gt;
&lt;p&gt;public function assertLink($label, $expected = true, $message = '%s') &lt;br /&gt;
{&lt;br /&gt;
if( !$expected )&lt;br /&gt;
{&lt;br /&gt;
$url = $this-&amp;gt;browser-&amp;gt;getLink($label);&lt;br /&gt;
return $this-&amp;gt;assertTrue($url !== false,&lt;br /&gt;
sprintf($message, "Link [$label] should exist"));&lt;br /&gt;
}&lt;/p&gt;
&lt;p&gt;//??? separate method?&lt;br /&gt;
$urls = $this-&amp;gt;browser-&amp;gt;getLinks($label);&lt;br /&gt;
$expectation = new IdenticalExpectation($expected);&lt;/p&gt;
&lt;p&gt;foreach( $urls as $url )&lt;br /&gt;
{&lt;br /&gt;
//copypaste form SimpleTestCase::assert()&lt;br /&gt;
$compare = $url-&amp;gt;asString();&lt;br /&gt;
if( $expectation-&amp;gt;test( $compare ) )&lt;br /&gt;
{&lt;br /&gt;
$msg = $expectation-&amp;gt;overlayMessage( $compare,&lt;br /&gt;
$this-&amp;gt;reporter-&amp;gt;getDumper() );&lt;br /&gt;
return $this-&amp;gt;pass(sprintf( $message, $msg ));&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
return $this-&amp;gt;fail( sprintf($message, "Link [$label] should exist") );&lt;br /&gt;
}&lt;/p&gt;&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Anonymous</dc:creator><pubDate>Wed, 03 Nov 2010 08:32:00 -0000</pubDate><guid>https://sourceforge.net2ddb9316c73aeaf9a62ac2ea654559b8eb1f407a</guid></item></channel></rss>