Conditions | 12 |
Paths | > 20000 |
Total Lines | 114 |
Code Lines | 61 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
1 | <?php |
||
56 | $this->faker->firstName . ' ' . $this->faker->lastName |
||
57 | ); |
||
58 | } catch (\Exception $exception) { |
||
59 | unset($exception); |
||
60 | } |
||
61 | |||
62 | /* |
||
63 | * Optional DNI: |
||
64 | */ |
||
65 | try { |
||
66 | $name = $this->webDriver->findElement(WebDriverBy::name('dni')); |
||
67 | $name->clear()->sendKeys($this->getDNI()); |
||
68 | } catch (\Exception $exception) { |
||
69 | unset($exception); |
||
70 | } |
||
71 | |||
72 | /* |
||
73 | * Optional BirthDate: |
||
74 | */ |
||
75 | try { |
||
76 | $select = new WebDriverSelect($this->webDriver->findElement(WebDriverBy::name('dob-day'))); |
||
77 | $select->selectByValue($this->faker->numberBetween(1, 28)); |
||
78 | $select = new WebDriverSelect($this->webDriver->findElement(WebDriverBy::name('dob-month'))); |
||
79 | $select->selectByValue($this->faker->numberBetween(1, 12)); |
||
80 | $select = new WebDriverSelect($this->webDriver->findElement(WebDriverBy::name('dob-year'))); |
||
81 | $select->selectByValue('1975'); |
||
82 | } catch (\Exception $exception) { |
||
83 | unset($exception); |
||
84 | } |
||
85 | |||
86 | /* |
||
87 | * Optional Phone: |
||
88 | */ |
||
89 | try { |
||
90 | $name = $this->webDriver->findElement(WebDriverBy::name('cellphone')); |
||
91 | $name->clear()->sendKeys('6' . $this->faker->randomNumber(8)); |
||
92 | } catch (\Exception $exception) { |
||
93 | unset($exception); |
||
94 | } |
||
95 | |||
96 | /* |
||
97 | * Optional address: |
||
98 | */ |
||
99 | try { |
||
100 | $name = $this->webDriver->findElement(WebDriverBy::name('address')); |
||
101 | $name->clear()->sendKeys($this->faker->address. ' ' . $this->faker->city); |
||
102 | } catch (\Exception $exception) { |
||
103 | unset($exception); |
||
104 | } |
||
105 | |||
106 | /* |
||
107 | * Optional city: |
||
108 | */ |
||
109 | try { |
||
110 | $name = $this->webDriver->findElement(WebDriverBy::name('city')); |
||
111 | $name->clear()->sendKeys($this->faker->city); |
||
112 | } catch (\Exception $exception) { |
||
113 | unset($exception); |
||
114 | } |
||
115 | |||
116 | /* |
||
117 | * Optional zipcode: |
||
118 | */ |
||
119 | try { |
||
120 | $name = $this->webDriver->findElement(WebDriverBy::name('zipcode')); |
||
121 | $name->clear()->sendKeys($this->faker->postcode); |
||
122 | } catch (\Exception $exception) { |
||
123 | unset($exception); |
||
124 | } |
||
125 | |||
126 | /* |
||
127 | * Optional password: |
||
128 | */ |
||
129 | try { |
||
130 | $name = $this->webDriver->findElement(WebDriverBy::name('password')); |
||
131 | if (null === SeleniumHelper::$mobilePhone) { |
||
132 | throw new \Exception('Please provide mobile phone for returning customer'); |
||
133 | } else { |
||
134 | $name->clear()->sendKeys(substr(SeleniumHelper::$mobilePhone, -4)); |
||
135 | } |
||
136 | } catch (\Exception $exception) { |
||
137 | unset($exception); |
||
138 | } |
||
139 | |||
140 | /* |
||
141 | * Click form continue |
||
142 | */ |
||
143 | try { |
||
144 | $formContinue = $this->webDriver->findElement(WebDriverBy::name('edit_customer_data_form_continue')); |
||
145 | $formContinue->click(); |
||
146 | } catch (\Exception $exception) { |
||
147 | unset($exception); |
||
148 | } |
||
149 | |||
150 | /* |
||
151 | * Click login button |
||
152 | */ |
||
153 | try { |
||
154 | $formContinue = $this->webDriver->findElement(WebDriverBy::name('login_modal_loginButton')); |
||
155 | $formContinue->click(); |
||
156 | } catch (\Exception $exception) { |
||
157 | unset($exception); |
||
158 | } |
||
159 | } |
||
160 | } |
||
161 |