We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
@@ 297-314 (lines=18) @@ | ||
294 | $this->assertEmpty($relationFields); |
|
295 | } |
|
296 | ||
297 | public function testSyncPivot() |
|
298 | { |
|
299 | $this->crudPanel->setModel(User::class); |
|
300 | $this->crudPanel->addFields($this->userInputFieldsManyToMany); |
|
301 | $faker = Factory::create(); |
|
302 | $inputData = [ |
|
303 | 'name' => $faker->name, |
|
304 | 'email' => $faker->safeEmail, |
|
305 | 'password' => bcrypt($faker->password()), |
|
306 | 'remember_token' => null, |
|
307 | 'roles' => [1, 2], |
|
308 | ]; |
|
309 | ||
310 | $entry = User::find(1); |
|
311 | $this->crudPanel->syncPivot($entry, $inputData); |
|
312 | ||
313 | $this->assertEquals($inputData['roles'], $entry->roles->pluck('id')->toArray()); |
|
314 | } |
|
315 | ||
316 | public function testSyncPivotUnknownData() |
|
317 | { |
|
@@ 316-333 (lines=18) @@ | ||
313 | $this->assertEquals($inputData['roles'], $entry->roles->pluck('id')->toArray()); |
|
314 | } |
|
315 | ||
316 | public function testSyncPivotUnknownData() |
|
317 | { |
|
318 | $this->crudPanel->setModel(User::class); |
|
319 | $this->crudPanel->addFields($this->nonRelationshipField); |
|
320 | $faker = Factory::create(); |
|
321 | $inputData = [ |
|
322 | 'name' => $faker->name, |
|
323 | 'email' => $faker->safeEmail, |
|
324 | 'password' => bcrypt($faker->password()), |
|
325 | 'remember_token' => null, |
|
326 | 'roles' => [1, 2], |
|
327 | ]; |
|
328 | ||
329 | $entry = User::find(1); |
|
330 | $this->crudPanel->syncPivot($entry, $inputData); |
|
331 | ||
332 | $this->assertEquals(1, $entry->roles->count()); |
|
333 | } |
|
334 | ||
335 | public function testSyncPivotUnknownModel() |
|
336 | { |
|
@@ 335-352 (lines=18) @@ | ||
332 | $this->assertEquals(1, $entry->roles->count()); |
|
333 | } |
|
334 | ||
335 | public function testSyncPivotUnknownModel() |
|
336 | { |
|
337 | $this->expectException(\BadMethodCallException::class); |
|
338 | ||
339 | $this->crudPanel->setModel(User::class); |
|
340 | $this->crudPanel->addFields($this->userInputFieldsManyToMany); |
|
341 | $faker = Factory::create(); |
|
342 | $inputData = [ |
|
343 | 'name' => $faker->name, |
|
344 | 'email' => $faker->safeEmail, |
|
345 | 'password' => bcrypt($faker->password()), |
|
346 | 'remember_token' => null, |
|
347 | 'roles' => [1, 2], |
|
348 | ]; |
|
349 | ||
350 | $entry = Article::find(1); |
|
351 | $this->crudPanel->syncPivot($entry, $inputData); |
|
352 | } |
|
353 | } |
|
354 |