Use DOMNodeList length property of DOMNodeList::count
DOMNodeList::count was added it php7.2 [MAILPOET-2712]
This commit is contained in:
committed by
Jack Kitterhing
parent
7f631a1166
commit
f11102ab34
@@ -51,8 +51,8 @@ class DateTest extends \MailPoetUnitTest {
|
|||||||
$html = $this->date->render($this->block);
|
$html = $this->date->render($this->block);
|
||||||
$mothsSelect = $this->htmlParser->getElementByXpath($html, "//select", 0);
|
$mothsSelect = $this->htmlParser->getElementByXpath($html, "//select", 0);
|
||||||
$yearsSelect = $this->htmlParser->getElementByXpath($html, "//select", 1);
|
$yearsSelect = $this->htmlParser->getElementByXpath($html, "//select", 1);
|
||||||
expect(count($mothsSelect->childNodes))->equals(13); // Months + placeholder
|
expect($mothsSelect->childNodes->length)->equals(13); // Months + placeholder
|
||||||
expect(count($yearsSelect->childNodes))->equals(101 + 1); // Years + placeholder
|
expect($yearsSelect->childNodes->length)->equals(101 + 1); // Years + placeholder
|
||||||
|
|
||||||
$date = Carbon::now();
|
$date = Carbon::now();
|
||||||
$currentMonth = $date->format('F');
|
$currentMonth = $date->format('F');
|
||||||
@@ -78,9 +78,9 @@ class DateTest extends \MailPoetUnitTest {
|
|||||||
$mothsSelect = $this->htmlParser->getElementByXpath($html, "//select", 0);
|
$mothsSelect = $this->htmlParser->getElementByXpath($html, "//select", 0);
|
||||||
$daysSelect = $this->htmlParser->getElementByXpath($html, "//select", 1);
|
$daysSelect = $this->htmlParser->getElementByXpath($html, "//select", 1);
|
||||||
$yearsSelect = $this->htmlParser->getElementByXpath($html, "//select", 2);
|
$yearsSelect = $this->htmlParser->getElementByXpath($html, "//select", 2);
|
||||||
expect(count($mothsSelect->childNodes))->equals(13); // Months + placeholder
|
expect($mothsSelect->childNodes->length)->equals(13); // Months + placeholder
|
||||||
expect(count($daysSelect->childNodes))->equals(32); // Days + placeholder
|
expect($daysSelect->childNodes->length)->equals(32); // Days + placeholder
|
||||||
expect(count($yearsSelect->childNodes))->equals(101 + 1); // Years + placeholder
|
expect($yearsSelect->childNodes->length)->equals(101 + 1); // Years + placeholder
|
||||||
|
|
||||||
$date = Carbon::now();
|
$date = Carbon::now();
|
||||||
$currentMonth = $date->format('F');
|
$currentMonth = $date->format('F');
|
||||||
|
@@ -48,7 +48,7 @@ class RendererTest extends \MailPoetUnitTest {
|
|||||||
->willReturn(Captcha::TYPE_DISABLED);
|
->willReturn(Captcha::TYPE_DISABLED);
|
||||||
$html = $this->renderer->renderBlocks(Fixtures::get('simple_form_body'));
|
$html = $this->renderer->renderBlocks(Fixtures::get('simple_form_body'));
|
||||||
$blocks = $this->htmlParser->findByXpath($html, "//div[@class='block']");
|
$blocks = $this->htmlParser->findByXpath($html, "//div[@class='block']");
|
||||||
expect($blocks->count())->equals(2);
|
expect($blocks->length)->equals(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testItShouldRenderHoneypot() {
|
public function testItShouldRenderHoneypot() {
|
||||||
@@ -59,9 +59,9 @@ class RendererTest extends \MailPoetUnitTest {
|
|||||||
->willReturn(Captcha::TYPE_DISABLED);
|
->willReturn(Captcha::TYPE_DISABLED);
|
||||||
$html = $this->renderer->renderBlocks(Fixtures::get('simple_form_body'));
|
$html = $this->renderer->renderBlocks(Fixtures::get('simple_form_body'));
|
||||||
$hpLabel = $this->htmlParser->findByXpath($html, "//label[@class='mailpoet_hp_email_label']");
|
$hpLabel = $this->htmlParser->findByXpath($html, "//label[@class='mailpoet_hp_email_label']");
|
||||||
expect($hpLabel->count())->equals(1);
|
expect($hpLabel->length)->equals(1);
|
||||||
$hpInput = $this->htmlParser->findByXpath($html, "//input[@type='email']");
|
$hpInput = $this->htmlParser->findByXpath($html, "//input[@type='email']");
|
||||||
expect($hpInput->count())->equals(1);
|
expect($hpInput->length)->equals(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testItShouldRenderReCaptcha() {
|
public function testItShouldRenderReCaptcha() {
|
||||||
@@ -75,9 +75,9 @@ class RendererTest extends \MailPoetUnitTest {
|
|||||||
]));
|
]));
|
||||||
$html = $this->renderer->renderBlocks(Fixtures::get('simple_form_body'));
|
$html = $this->renderer->renderBlocks(Fixtures::get('simple_form_body'));
|
||||||
$recaptcha = $this->htmlParser->findByXpath($html, "//div[@class='mailpoet_recaptcha']");
|
$recaptcha = $this->htmlParser->findByXpath($html, "//div[@class='mailpoet_recaptcha']");
|
||||||
expect($recaptcha->count())->equals(1);
|
expect($recaptcha->length)->equals(1);
|
||||||
$recaptchaIframes = $this->htmlParser->findByXpath($html, "//iframe");
|
$recaptchaIframes = $this->htmlParser->findByXpath($html, "//iframe");
|
||||||
expect($recaptchaIframes->count())->equals(1);
|
expect($recaptchaIframes->length)->equals(1);
|
||||||
$iframe = $recaptchaIframes->item(0);
|
$iframe = $recaptchaIframes->item(0);
|
||||||
assert($iframe instanceof \DOMNode);
|
assert($iframe instanceof \DOMNode);
|
||||||
$source = $iframe->attributes->getNamedItem('src');
|
$source = $iframe->attributes->getNamedItem('src');
|
||||||
@@ -93,8 +93,8 @@ class RendererTest extends \MailPoetUnitTest {
|
|||||||
->willReturn(Captcha::TYPE_DISABLED);
|
->willReturn(Captcha::TYPE_DISABLED);
|
||||||
$html = $this->renderer->renderBlocks(Fixtures::get('simple_form_body'), false);
|
$html = $this->renderer->renderBlocks(Fixtures::get('simple_form_body'), false);
|
||||||
$hpLabel = $this->htmlParser->findByXpath($html, "//label[@class='mailpoet_hp_email_label']");
|
$hpLabel = $this->htmlParser->findByXpath($html, "//label[@class='mailpoet_hp_email_label']");
|
||||||
expect($hpLabel->count())->equals(0);
|
expect($hpLabel->length)->equals(0);
|
||||||
$recaptcha = $this->htmlParser->findByXpath($html, "//div[@class='mailpoet_recaptcha']");
|
$recaptcha = $this->htmlParser->findByXpath($html, "//div[@class='mailpoet_recaptcha']");
|
||||||
expect($recaptcha->count())->equals(0);
|
expect($recaptcha->length)->equals(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user