From 567143b3ff673cc7004c3420f9a096c9157866fd Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Fri, 15 Oct 2010 02:48:27 +0000 Subject: [PATCH] MINOR More solid markup testing in TableListFieldTest through xpath (from r105305) git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@112496 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- tests/forms/TableListFieldTest.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tests/forms/TableListFieldTest.php b/tests/forms/TableListFieldTest.php index 77f25aeb3..df8e85bff 100755 --- a/tests/forms/TableListFieldTest.php +++ b/tests/forms/TableListFieldTest.php @@ -150,11 +150,13 @@ class TableListFieldTest extends SapphireTest { $table->addSelectOptions(array("F"=>"FieldF")); $tableHTML = $table->FieldHolder(); - $this->assertContains('rel="F"', $tableHTML); - $this->assertRegExp('/]*id="record-Tester-' . $obj1->ID . '"[^>]*>[^<]*]*class="markingcheckbox F"[^>]*>/si', $tableHTML); - $this->assertRegExp('/]*id="record-Tester-' . $obj1->ID . '"[^>]*>[^<]*]*class="markingcheckbox"[^>]*>/si', $tableHTML); - $this->assertRegExp('/]*id="record-Tester-' . $obj3->ID . '"[^>]*>[^<]*]*class="markingcheckbox F"[^>]*>/si', $tableHTML); + $p = new CSSContentParser($tableHTML); + $this->assertContains('rel="F"', $tableHTML); + $tbody = $p->getByXpath('//tbody'); + $this->assertContains('markingcheckbox F', (string)$tbody[0]->tr[0]->td[0]['class']); + $this->assertContains('markingcheckbox', (string)$tbody[0]->tr[1]->td[0]['class']); + $this->assertContains('markingcheckbox F', (string)$tbody[0]->tr[2]->td[0]['class']); } /**