| Conditions | 1 |
| Paths | 1 |
| Total Lines | 59 |
| Code Lines | 45 |
| 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 |
||
| 113 | } |
||
| 114 | |||
| 115 | /** |
||
| 116 | * Ensure a manager can create a Job Poster. |
||
| 117 | * |
||
| 118 | * @return void |
||
| 119 | */ |
||
| 120 | public function testManagerCreate() : void |
||
| 121 | { |
||
| 122 | $newJob = [ |
||
| 123 | 'term_qty' => $this->faker->numberBetween(1, 4), |
||
| 124 | 'salary_min' => $this->faker->numberBetween(60000, 80000), |
||
| 125 | 'salary_max' => $this->faker->numberBetween(80000, 100000), |
||
| 126 | 'noc' => $this->faker->numberBetween(1, 9999), |
||
| 127 | 'classification' => $this->faker->regexify('[A-Z]{2}-0[1-5]'), |
||
| 128 | 'manager_id' => $this->manager->id, |
||
| 129 | 'published' => false, |
||
| 130 | 'remote_work_allowed' => $this->faker->boolean(50), |
||
| 131 | 'open_date' => $this->faker->date('Y-m-d', strtotime('+1 day')), |
||
| 132 | 'open_time' => $this->faker->time(), |
||
| 133 | 'close_date' => $this->faker->date('Y-m-d', strtotime('+2 weeks')), |
||
| 134 | 'close_time' => $this->faker->time(), |
||
| 135 | 'start_date_time' => $this->faker->date('Y-m-d', strtotime('+2 weeks')) . ' ' . $this->faker->time(), |
||
| 136 | 'security_clearance' => SecurityClearance::inRandomOrder()->first()->id, |
||
| 137 | 'language_requirement' => LanguageRequirement::inRandomOrder()->first()->id, |
||
| 138 | 'department' => Department::inRandomOrder()->first()->id, |
||
| 139 | 'province' => Province::inRandomOrder()->first()->id, |
||
| 140 | 'city' => $this->faker->city, |
||
| 141 | 'title' => [ |
||
| 142 | 'en' => $this->faker->word, |
||
| 143 | 'fr' => $this->faker_fr->word |
||
| 144 | ], |
||
| 145 | 'impact' => [ |
||
| 146 | 'en' => $this->faker->paragraphs( |
||
| 147 | 2, |
||
| 148 | true |
||
| 149 | ), |
||
| 150 | 'fr' => $this->faker_fr->paragraphs( |
||
| 151 | 2, |
||
| 152 | true |
||
| 153 | ) |
||
| 154 | ], |
||
| 155 | 'branch' => [ |
||
| 156 | 'en' => $this->faker->word, |
||
| 157 | 'fr' => $this->faker_fr->word |
||
| 158 | ], |
||
| 159 | 'division' => [ |
||
| 160 | 'en' => $this->faker->word, |
||
| 161 | 'fr' => $this->faker_fr->word |
||
| 162 | ], |
||
| 163 | 'education' => [ |
||
| 164 | 'en' => $this->faker->sentence(), |
||
| 165 | 'fr' => $this->faker_fr->sentence() |
||
| 166 | ], |
||
| 167 | 'submit' => '', |
||
| 168 | ]; |
||
| 169 | |||
| 170 | $dbValues = array_slice($newJob, 0, 8); |
||
| 171 | |||
| 172 | $response = $this->followingRedirects() |
||
| 216 |