Scrutinizer GitHub App not installed

We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.

Install GitHub App

Completed
Push — master ( 861d7d...2ad8d1 )
by Cristian
04:38
created

CrudPanelDeleteTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 33.33 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 9
loc 27
rs 10
wmc 2
lcom 1
cbo 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testDelete() 0 14 1
A testDeleteUnknown() 9 9 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
namespace Backpack\CRUD\Tests\Unit\CrudPanel;
4
5
use Illuminate\Support\Facades\DB;
6
use Backpack\CRUD\Tests\Unit\Models\Article;
7
use Illuminate\Database\Eloquent\ModelNotFoundException;
8
9
class CrudPanelDeleteTest extends BaseDBCrudPanelTest
10
{
11
    public function testDelete()
12
    {
13
        $this->markTestIncomplete('Not correctly implemented');
14
15
        $this->crudPanel->setModel(Article::class);
16
        $article = Article::find(1);
17
18
        $wasDeleted = $this->crudPanel->delete($article->id);
19
20
        // TODO: the delete method should not convert the returned result to a string
21
        $deletedArticle = Article::find(1);
22
        $this->assertTrue($wasDeleted);
23
        $this->assertNull($deletedArticle);
24
    }
25
26 View Code Duplication
    public function testDeleteUnknown()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
27
    {
28
        $this->setExpectedException(ModelNotFoundException::class);
29
30
        $this->crudPanel->setModel(Article::class);
31
        $unknownId = DB::getPdo()->lastInsertId() + 1;
32
33
        $this->crudPanel->delete($unknownId);
34
    }
35
}
36