1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Backpack\CRUD\Tests\Unit\CrudPanel; |
4
|
|
|
|
5
|
|
|
use Backpack\CRUD\Tests\config\Models\User; |
6
|
|
|
use Illuminate\Routing\Route; |
7
|
|
|
|
8
|
|
|
/** |
9
|
|
|
* @covers Backpack\CRUD\app\Library\CrudPanel\Traits\HeadingsAndTitles |
10
|
|
|
* @covers Backpack\CRUD\app\Library\CrudPanel\CrudPanel |
11
|
|
|
*/ |
12
|
|
|
class CrudPanelTitlesAndHeadingsTest extends \Backpack\CRUD\Tests\config\CrudPanel\BaseCrudPanel |
13
|
|
|
{ |
14
|
|
|
public function testItCanSetAndGetTheTitleFromTheAction() |
15
|
|
|
{ |
16
|
|
|
$this->crudPanel->setTitle('test', 'create'); |
17
|
|
|
$this->assertEquals('test', $this->crudPanel->getTitle('create')); |
|
|
|
|
18
|
|
|
$this->assertEquals($this->crudPanel->get('create.title'), $this->crudPanel->getTitle('create')); |
19
|
|
|
} |
20
|
|
|
|
21
|
|
|
public function testItCanSetAndGetTheHeadingFromTheAction() |
22
|
|
|
{ |
23
|
|
|
$this->crudPanel->setHeading('test', 'create'); |
24
|
|
|
$this->assertEquals('test', $this->crudPanel->getHeading('create')); |
|
|
|
|
25
|
|
|
$this->assertEquals($this->crudPanel->get('create.heading'), $this->crudPanel->getHeading('create')); |
26
|
|
|
} |
27
|
|
|
|
28
|
|
|
public function testItCanSetAndGetTheSubheadingFromTheAction() |
29
|
|
|
{ |
30
|
|
|
$this->crudPanel->setSubheading('test', 'create'); |
31
|
|
|
$this->assertEquals('test', $this->crudPanel->getSubheading('create')); |
|
|
|
|
32
|
|
|
$this->assertEquals($this->crudPanel->get('create.subheading'), $this->crudPanel->getSubheading('create')); |
33
|
|
|
} |
34
|
|
|
|
35
|
|
|
public function testItCanSetAndGetTheSubheading() |
36
|
|
|
{ |
37
|
|
|
$this->crudPanel->setModel(User::class); |
38
|
|
|
$this->setupUserCreateRequest(); |
39
|
|
|
|
40
|
|
|
$this->crudPanel->setOperation('create'); |
41
|
|
|
$this->crudPanel->setSubheading('test'); |
42
|
|
|
$this->assertEquals('test', $this->crudPanel->getSubheading()); |
43
|
|
|
$this->assertEquals($this->crudPanel->get('create.subheading'), $this->crudPanel->getSubheading()); |
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
public function testItCanSetAndGetTheHeading() |
47
|
|
|
{ |
48
|
|
|
$this->crudPanel->setModel(User::class); |
49
|
|
|
$this->setupUserCreateRequest(); |
50
|
|
|
|
51
|
|
|
$this->crudPanel->setOperation('create'); |
52
|
|
|
$this->crudPanel->setHeading('test'); |
53
|
|
|
$this->assertEquals('test', $this->crudPanel->getHeading()); |
54
|
|
|
$this->assertEquals($this->crudPanel->get('create.heading'), $this->crudPanel->getHeading()); |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
public function testItCanSetAndGetTheTitle() |
58
|
|
|
{ |
59
|
|
|
$this->crudPanel->setModel(User::class); |
60
|
|
|
$this->setupUserCreateRequest(); |
61
|
|
|
|
62
|
|
|
$this->crudPanel->setOperation('create'); |
63
|
|
|
$this->crudPanel->setTitle('test'); |
64
|
|
|
|
65
|
|
|
$this->assertEquals('test', $this->crudPanel->getTitle()); |
66
|
|
|
$this->assertEquals($this->crudPanel->get('create.title'), $this->crudPanel->getTitle()); |
67
|
|
|
} |
68
|
|
|
} |
69
|
|
|
|