@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | $session = $this->getSession(); |
51 | 51 | $element = $session->getPage()->find( |
52 | 52 | 'xpath', |
53 | - $session->getSelectorsHandler()->selectorToXpath('xpath', '//*[contains(text(),"' . $text . '")]')); |
|
53 | + $session->getSelectorsHandler()->selectorToXpath('xpath', '//*[contains(text(),"'.$text.'")]')); |
|
54 | 54 | |
55 | 55 | if (null === $element) { |
56 | 56 | throw new \InvalidArgumentException(sprintf('Cannot find text: "%s"', $text)); |
@@ -61,21 +61,21 @@ discard block |
||
61 | 61 | |
62 | 62 | public function assertValueInInput($value, $input) { |
63 | 63 | |
64 | - if (substr($input,0,1) != "#") { |
|
65 | - $input = "#" . $input; |
|
64 | + if (substr($input, 0, 1) != "#") { |
|
65 | + $input = "#".$input; |
|
66 | 66 | } |
67 | 67 | $session = $this->getSession(); |
68 | 68 | $element = $session->getPage()->find('css', $input); |
69 | 69 | $text = ""; |
70 | 70 | |
71 | - if(isset($element)) { |
|
71 | + if (isset($element)) { |
|
72 | 72 | $text = $element->getValue(); |
73 | 73 | } |
74 | 74 | else { |
75 | 75 | throw new \Exception(sprintf("Element is null")); |
76 | 76 | } |
77 | 77 | |
78 | - if($text === $value) { |
|
78 | + if ($text === $value) { |
|
79 | 79 | return true; |
80 | 80 | } |
81 | 81 | else { |
@@ -107,12 +107,12 @@ discard block |
||
107 | 107 | |
108 | 108 | $html = $this->getSession()->getDriver()->getContent(); |
109 | 109 | $text = $this->validateTextForSearchInSource($text); |
110 | - $regex = '/' . $text . '/'; |
|
110 | + $regex = '/'.$text.'/'; |
|
111 | 111 | |
112 | 112 | preg_match($regex, $html, $results); |
113 | 113 | |
114 | 114 | if ($results == null) { |
115 | - throw new \Exception('The searched text ' . $text . ' was not found in the source of the page.'); |
|
115 | + throw new \Exception('The searched text '.$text.' was not found in the source of the page.'); |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | return true; |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | |
132 | 132 | $session = $this->getSession(); |
133 | 133 | $element = $session->getPage()->find('region', $region)->find('xpath', $session->getSelectorsHandler()->selectorToXpath('xpath', |
134 | - '//*[contains(text(),"' . $text . '")]')); |
|
134 | + '//*[contains(text(),"'.$text.'")]')); |
|
135 | 135 | |
136 | 136 | if (null === $element) { |
137 | 137 | throw new \InvalidArgumentException(sprintf('Cannot find text: "%s"', $text)); |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | |
145 | 145 | $session = $this->getSession(); |
146 | 146 | $element = $session->getPage()->find('region', $region)->find('xpath', $session->getSelectorsHandler()->selectorToXpath('xpath', |
147 | - '//*[contains(text(),"' . $text . '")]')); |
|
147 | + '//*[contains(text(),"'.$text.'")]')); |
|
148 | 148 | |
149 | 149 | if (null === $element) { |
150 | 150 | throw new \InvalidArgumentException(sprintf('Cannot find text: "%s"', $text)); |
@@ -70,15 +70,13 @@ discard block |
||
70 | 70 | |
71 | 71 | if(isset($element)) { |
72 | 72 | $text = $element->getValue(); |
73 | - } |
|
74 | - else { |
|
73 | + } else { |
|
75 | 74 | throw new \Exception(sprintf("Element is null")); |
76 | 75 | } |
77 | 76 | |
78 | 77 | if($text === $value) { |
79 | 78 | return true; |
80 | - } |
|
81 | - else { |
|
79 | + } else { |
|
82 | 80 | throw new \Exception(sprintf('Value of input : "%s" does not match the text "%s"', $text, $value)); |
83 | 81 | } |
84 | 82 | } |
@@ -92,8 +90,7 @@ discard block |
||
92 | 90 | $this->iShouldSeeInTheSourceOfThePage($text); |
93 | 91 | $isTextFound = true; |
94 | 92 | break; |
95 | - } |
|
96 | - catch (\Exception $e) { |
|
93 | + } catch (\Exception $e) { |
|
97 | 94 | sleep(1); |
98 | 95 | } |
99 | 96 | } |