publicfunctiontestAssertSelectorCount() { $this->getCrawlerTester(newCrawler('<html><body><p>Hello</p></body></html>'))->assertSelectorCount(1, 'p'); $this->getCrawlerTester(newCrawler('<html><body><p>Hello</p><p>Foo</p></body></html>'))->assertSelectorCount(2, 'p'); $this->getCrawlerTester(newCrawler('<html><body><h1>This is not a paragraph.</h1></body></html>'))->assertSelectorCount(0, 'p'); $this->expectException(AssertionFailedError::class); $this->expectExceptionMessage('Failed asserting that the Crawler selector "p" was expected to be found 0 time(s) but was found 1 time(s).'); $this->getCrawlerTester(newCrawler('<html><body><p>Hello</p></body></html>'))->assertSelectorCount(0, 'p'); }