コード例 #1
0
ファイル: AbstractTest.php プロジェクト: NicolasSchmutz/cm
 public function testLoadPageTrackingError()
 {
     CM_Config::get()->CM_Http_Response_Page->exceptionsToCatch['CM_Exception_Nonexistent'] = ['errorPage' => 'CM_Page_View_Ajax_Test_Mock'];
     $page = new CM_Page_View_Ajax_Test_Mock();
     $request = $this->createRequestAjax($page, 'loadPage', ['path' => '/iwhdfkjlsh']);
     $response = new CM_Http_Response_View_Ajax($request, $this->_getServiceManagerWithGA('ga123'));
     $response->process();
     $this->assertViewResponseSuccess($response);
     $responseContent = CM_Params::decode($response->getContent(), true);
     $jsTracking = $responseContent['success']['data']['jsTracking'];
     $html = $responseContent['success']['data']['html'];
     $this->assertSame(1, substr_count($jsTracking, 'ga("send", "pageview"'));
     $this->assertContains('ga("send", "pageview", "\\/iwhdfkjlsh")', $jsTracking);
     $this->assertContains('CM_Page_View_Ajax_Test_Mock', $html);
 }