我正在尝试检查使用 PHPUnit 时是否存在某些页面和 div。
到目前为止,这就是部分代码的样子
<?php
class CheckIfPageExistsTest extends TestPageCase
{
public function testCheckIfPageExists()
{
$PageType = $this->findPage('/about/obvusta-employees');
$checkMenusInPage = $PageType->find('css', 'div#obvusta-employees');
$this->assertNotNull($checkMenusInPage);
}
}
现在这个测试返回正面的/about/obvusta-emplyees
页面和页面内部,如果div#obvusta-employees
存在的话。
现在,如果我想测试多个页面而不是一个页面,我该如何遍历所述链接并检查它们,而不是为每个页面创建一个测试文件?
因为,该网站目前有大约 50 个页面,例如contact/parent-company
,contact/write-feedbacks
...所以,我需要提前声明这些页面并循环它们,