Allow but ignore not string content in MailPoet\Form\DisplayFormInWPContent

[MAILPOET-2699]
This commit is contained in:
Rostislav Wolny
2020-02-12 17:00:46 +01:00
committed by Jack Kitterhing
parent 57d480c6e4
commit 490a72aed3
2 changed files with 18 additions and 2 deletions

View File

@@ -59,6 +59,16 @@ class DisplayFormInWPContentTest extends \MailPoetUnitTest {
expect($result)->endsWith($renderedFormStyles . $renderedForm);
}
public function testItPassThruNonStringPostContent() {
$this->wp->expects($this->never())->method('isSingle');
$this->wp->expects($this->never())->method('isSingular');
$this->repository->expects($this->never())->method('findAll');
expect($this->hook->display(null))->null();
expect($this->hook->display([1,2,3]))->equals([1,2,3]);
expect($this->hook->display(1))->equals(1);
expect($this->hook->display(1.1))->equals(1.1);
}
public function testDoesNotAppendFormIfDisabled() {
$this->wp->expects($this->once())->method('isSingle')->willReturn(true);
$this->wp->expects($this->any())->method('isPage')->willReturn(false);