@@ -114,19 +114,15 @@ public function assertNotHasElementWithAttributes($attributes = [], $output = ''
114114 */
115115 public function assertElementContains ($ contents , $ selector = '' , $ output = '' , $ message = '' )
116116 {
117- if (method_exists ($ this , 'assertStringContainsString ' )) {
118- $ this ->assertStringContainsString (
119- $ contents ,
120- $ this ->getInnerHtmlOfMatchedElements ($ output , $ selector ),
121- $ message
122- );
123- } else {
124- $ this ->assertContains (
125- $ contents ,
126- $ this ->getInnerHtmlOfMatchedElements ($ output , $ selector ),
127- $ message
128- );
129- }
117+ $ method = method_exists ($ this , 'assertStringContainsString ' )
118+ ? 'assertStringContainsString '
119+ : 'assertContains ' ;
120+
121+ $ this ->$ method (
122+ $ contents ,
123+ $ this ->getInnerHtmlOfMatchedElements ($ output , $ selector ),
124+ $ message
125+ );
130126 }
131127
132128 /**
@@ -141,20 +137,15 @@ public function assertElementContains($contents, $selector = '', $output = '', $
141137 */
142138 public function assertElementNotContains ($ contents , $ selector = '' , $ output = '' , $ message = '' )
143139 {
144- if (method_exists ($ this , 'assertStringNotContainsString ' )) {
145- $ this ->assertStringNotContainsString (
146- $ contents ,
147- $ this ->getInnerHtmlOfMatchedElements ($ output , $ selector ),
148- $ message
149- );
150- }
151- else {
152- $ this ->assertNotContains (
153- $ contents ,
154- $ this ->getInnerHtmlOfMatchedElements ($ output , $ selector ),
155- $ message
156- );
157- }
140+ $ method = method_exists ($ this , 'assertStringNotContainsString ' )
141+ ? 'assertStringNotContainsString '
142+ : 'assertNotContains ' ;
143+
144+ $ this ->$ method (
145+ $ contents ,
146+ $ this ->getInnerHtmlOfMatchedElements ($ output , $ selector ),
147+ $ message
148+ );
158149 }
159150
160151 /**
0 commit comments