pageContent = $content; // Ideally we would validate $content as valid html here. // Suppress console output. $content = ''; $this->smartyVariables = CRM_Core_Smarty::singleton()->get_template_vars(); } /** * Assert that the page output contains the expected strings. * * @param $expectedStrings */ protected function assertPageContains($expectedStrings) { foreach ($expectedStrings as $expectedString) { $this->assertContains($expectedString, $this->pageContent); } } /** * Assert that the expected variables have been assigned to Smarty. * * @param $expectedVariables */ protected function assertSmartyVariables($expectedVariables) { foreach ($expectedVariables as $variableName => $expectedValue) { $this->assertEquals($expectedValue, $this->smartyVariables[$variableName]); } } /** * Set up environment to listen for page content. */ protected function listenForPageContent() { $this->hookClass->setHook('civicrm_alterContent', [ $this, 'checkPageContent' ]); } }