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

Test Failed
Pull Request — main (#4778)
by Pedro
25:44 queued 10:58
created

CrudPanelMacroTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 11
c 1
b 0
f 1
dl 0
loc 22
rs 10
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testThrowsErrorIfMacroExists() 0 11 2
A testItCanRegisterMacro() 0 7 1
1
<?php
2
3
namespace Backpack\CRUD\Tests\Unit\CrudPanel;
4
5
/**
6
 * @covers Backpack\CRUD\app\Library\CrudPanel\Traits\Macroable
7
 */
8
class CrudPanelMacroTest extends BaseCrudPanelTest
9
{
10
    public function testItCanRegisterMacro()
11
    {
12
        $this->crudPanel::macro('validMacro', function () {
13
            return true;
14
        });
15
16
        $this->assertTrue($this->crudPanel->validMacro());
0 ignored issues
show
Bug introduced by
The method validMacro() does not exist on Backpack\CRUD\app\Library\CrudPanel\CrudPanel. Since you implemented __call, consider adding a @method annotation. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

16
        $this->assertTrue($this->crudPanel->/** @scrutinizer ignore-call */ validMacro());
Loading history...
17
    }
18
19
    public function testThrowsErrorIfMacroExists()
20
    {
21
        try {
22
            $this->crudPanel::macro('setModel', function () {
23
                return true;
24
            });
25
        } catch (\Throwable $e) {
0 ignored issues
show
Coding Style Comprehensibility introduced by
Consider adding a comment why this CATCH block is empty.
Loading history...
26
        }
27
        $this->assertEquals(
28
          new \Symfony\Component\HttpKernel\Exception\HttpException(500, 'Cannot register \'setModel\' macro. \'setModel()\' already exists on Backpack\CRUD\app\Library\CrudPanel\CrudPanel'),
29
          $e
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $e does not seem to be defined for all execution paths leading up to this point.
Loading history...
30
      );
31
    }
32
}
33