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