Laravel-Backpack /
CRUD
We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
| 1 | <?php |
||
| 2 | |||
| 3 | namespace Backpack\CRUD\Tests\Unit\CrudPanel; |
||
| 4 | |||
| 5 | use Backpack\CRUD\Tests\config\CrudPanel\BaseCrudPanel; |
||
| 6 | |||
| 7 | /** |
||
| 8 | * @covers Backpack\CRUD\app\Library\CrudPanel\Traits\Macroable |
||
| 9 | */ |
||
| 10 | class CrudPanelMacroTest extends BaseCrudPanel |
||
| 11 | { |
||
| 12 | public function testItCanRegisterMacro() |
||
| 13 | { |
||
| 14 | $this->crudPanel::macro('validMacro', function () { |
||
| 15 | return true; |
||
| 16 | }); |
||
| 17 | |||
| 18 | $this->assertTrue($this->crudPanel->validMacro()); |
||
| 19 | } |
||
| 20 | |||
| 21 | public function testThrowsErrorIfMacroExists() |
||
| 22 | { |
||
| 23 | try { |
||
| 24 | $this->crudPanel::macro('setModel', function () { |
||
| 25 | return true; |
||
| 26 | }); |
||
| 27 | } catch (\Throwable $e) { |
||
|
0 ignored issues
–
show
Coding Style
Comprehensibility
introduced
by
Loading history...
|
|||
| 28 | } |
||
| 29 | $this->assertEquals( |
||
| 30 | new \Symfony\Component\HttpKernel\Exception\HttpException(500, 'Cannot register \'setModel\' macro. \'setModel()\' already exists on Backpack\CRUD\app\Library\CrudPanel\CrudPanel', null, ['developer-error-exception']), |
||
| 31 | $e |
||
|
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
|
|||
| 32 | ); |
||
| 33 | } |
||
| 34 | } |
||
| 35 |