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