logInAs('admin'); $this->get( 'admin/pages/?' . http_build_query([ 'q' => [ 'Term' => 'Page 10', 'FilterClass' => CMSSiteTreeFilter_Search::class, ] ]) ); $titles = $this->getPageTitles(); $this->assertEquals(count($titles), 1); // For some reason the title gets split into two lines $this->assertContains('Page 1', $titles[0]); } protected function getPageTitles() { $titles = []; $links = $this->cssParser()->getBySelector('.col-getTreeTitle span.item'); if ($links) { foreach ($links as $link) { $titles[] = preg_replace('/\n/', ' ', $link->asXML()); } } return $titles; } }