PHPUnit を使用して、ページにテキストが存在するかどうかを確認しようとしています。assertRegExp は機能しますが、if ステートメントを使用するとエラーが発生しますFailed asserting that null is true.
$test が null を返すことは理解していますが、テキストが存在する場合に 1 または 0 または true/false を返す方法がわかりません。どんな助けでも感謝します。
$element = $this->byCssSelector('body')->text();
$test = $this->assertRegExp('/find this text/i',$element);
if($this->assertTrue($test)){
echo 'text found';
}
else{
echo 'not found';
}