mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 02:56:15 +00:00
Adding tests for getCrumbs
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5632 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
7ba8247a53
commit
2e2f20ab82
2 changed files with 28 additions and 3 deletions
|
@ -799,9 +799,6 @@ class FormHelperTest extends CakeTestCase {
|
|||
$this->assertPattern('/^<form\s+id="ContactAddForm"\s+method="post"\s+action="\/contacts\/add\/"\s*>$/', $result);
|
||||
$this->assertNoPattern('/^<form[^<>]+[^id|method|action]=[^<>]*>/', $result);
|
||||
|
||||
/*
|
||||
* This is how you write tests for tag-based output.
|
||||
*/
|
||||
$result = $this->Form->input('name');
|
||||
$this->assertPattern('/^<div[^<>]+><label[^<>]+>Name<\/label><input [^<>]+ \/><\/div>$/', $result);
|
||||
$this->assertPattern('/^<div[^<>]+class="input">/', $result);
|
||||
|
|
|
@ -71,7 +71,35 @@ class HtmlHelperTest extends UnitTestCase {
|
|||
$result = $this->Html->style(array('display'=> 'none', 'margin'=>'10px'), false);
|
||||
$expected = "display:none;\nmargin:10px;";
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
function testBreadcrumb() {
|
||||
$this->Html->addCrumb('First', '#first');
|
||||
$this->Html->addCrumb('Second', '#second');
|
||||
$this->Html->addCrumb('Third', '#third');
|
||||
|
||||
$result = $this->Html->getCrumbs();
|
||||
$this->assertPattern('/^<a[^<>]+>First<\/a>»<a[^<>]+>Second<\/a>»<a[^<>]+>Third<\/a>$/', $result);
|
||||
$this->assertPattern('/<a\s+href=["\']+\#first["\']+[^<>]*>First<\/a>/', $result);
|
||||
$this->assertPattern('/<a\s+href=["\']+\#second["\']+[^<>]*>Second<\/a>/', $result);
|
||||
$this->assertPattern('/<a\s+href=["\']+\#third["\']+[^<>]*>Third<\/a>/', $result);
|
||||
$this->assertNoPattern('/<a[^<>]+[^href]=[^<>]*>/', $result);
|
||||
|
||||
$result = $this->Html->getCrumbs(' > ');
|
||||
$this->assertPattern('/^<a[^<>]+>First<\/a> > <a[^<>]+>Second<\/a> > <a[^<>]+>Third<\/a>$/', $result);
|
||||
$this->assertPattern('/<a\s+href=["\']+\#first["\']+[^<>]*>First<\/a>/', $result);
|
||||
$this->assertPattern('/<a\s+href=["\']+\#second["\']+[^<>]*>Second<\/a>/', $result);
|
||||
$this->assertPattern('/<a\s+href=["\']+\#third["\']+[^<>]*>Third<\/a>/', $result);
|
||||
$this->assertNoPattern('/<a[^<>]+[^href]=[^<>]*>/', $result);
|
||||
|
||||
$this->Html->addCrumb('Fourth', null);
|
||||
|
||||
$result = $this->Html->getCrumbs();
|
||||
$this->assertPattern('/^<a[^<>]+>First<\/a>»<a[^<>]+>Second<\/a>»<a[^<>]+>Third<\/a>»Fourth$/', $result);
|
||||
$this->assertPattern('/<a\s+href=["\']+\#first["\']+[^<>]*>First<\/a>/', $result);
|
||||
$this->assertPattern('/<a\s+href=["\']+\#second["\']+[^<>]*>Second<\/a>/', $result);
|
||||
$this->assertPattern('/<a\s+href=["\']+\#third["\']+[^<>]*>Third<\/a>/', $result);
|
||||
$this->assertNoPattern('/<a[^<>]+[^href]=[^<>]*>/', $result);
|
||||
}
|
||||
|
||||
function tearDown() {
|
||||
|
|
Loading…
Add table
Reference in a new issue