我正在使用Goutte(它是 Symfony 功能测试组件的独立包)来测试 Wordpress 主题:
public function testDocumentHasBasicNodes(){
$this->assertEquals(1, $this->crawler->filter('title')->count(),
'document shall have a TITLE node');
$this->assertEquals(1, $this->crawler->filter('meta')->count(),
'document shall have a meta[charset="utf-8"] node');
}
第一个测试通过但:
indexTest::testDocumentHasBasicNodes
document shall have a meta[charset="utf-8"] node
Failed asserting that 0 matches expected 1.
所以总结一下我的问题:
如何使用 Goutte / Symfony CSS Selector 组件按属性获取节点?