File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change 13
13
namespace Symfony \Cmf \Component \Testing \Functional ;
14
14
15
15
use Symfony \Bundle \FrameworkBundle \Test \WebTestCase ;
16
+ use Symfony \Component \HttpFoundation \Response ;
16
17
use Symfony \Component \DependencyInjection \Container ;
17
18
18
19
/**
@@ -121,4 +122,21 @@ protected static function createKernel(array $options = array())
121
122
122
123
return parent ::createKernel ($ options );
123
124
}
125
+
126
+ protected function assertResponseSuccess (Response $ response )
127
+ {
128
+ libxml_use_internal_errors (true );
129
+
130
+ $ dom = new \DomDocument ();
131
+ $ dom ->loadHTML ($ response ->getContent ());
132
+
133
+ $ xpath = new \DOMXpath ($ dom );
134
+ $ result = $ xpath ->query ('//div[contains(@class,"text-exception")]/h1 ' );
135
+ $ exception = null ;
136
+ if ($ result ->length ) {
137
+ $ exception = $ result ->item (0 )->nodeValue ;
138
+ }
139
+
140
+ $ this ->assertEquals (200 , $ response ->getStatusCode (), $ exception ? 'Exception: " ' .$ exception .'" ' : null );
141
+ }
124
142
}
You can’t perform that action at this time.
0 commit comments