1 | <?php |
||
16 | class LogViewerAdminTest extends FunctionalTest |
||
17 | { |
||
18 | /** |
||
19 | * {@inheritDoc} |
||
20 | */ |
||
21 | protected static $fixture_file = 'LogViewerAdminTest.yml'; |
||
22 | |||
23 | /** |
||
24 | * The test subject |
||
25 | * |
||
26 | * @var LogViewerAdmin |
||
27 | */ |
||
28 | protected $logViewerAdmin; |
||
29 | |||
30 | /** |
||
31 | * {@inheritDoc} |
||
32 | */ |
||
33 | public function setUp() |
||
34 | { |
||
35 | parent::setUp(); |
||
36 | |||
37 | $this->logViewerAdmin = new LogViewerAdmin; |
||
38 | $this->logViewerAdmin->doInit(); |
||
39 | } |
||
40 | |||
41 | /** |
||
42 | * Test that the log entries are returned in reverse order of creation date/time |
||
43 | */ |
||
44 | public function testLogsShouldBeInReverseOrder() |
||
45 | { |
||
46 | $entries = $this->logViewerAdmin->getList(); |
||
47 | $this->assertSame('INFO', $entries->first()->Level); |
||
48 | $this->assertSame('DEBUG', $entries->last()->Level); |
||
49 | } |
||
50 | |||
51 | /** |
||
52 | * Test that the GridField "add new" button has been removed |
||
53 | */ |
||
54 | public function testNoAddButton() |
||
55 | { |
||
56 | $this->assertNull($this->getConfig()->getComponentByType(GridFieldAddNewButton::class)); |
||
57 | } |
||
58 | |||
59 | /** |
||
60 | * Test that there's a "clear all" button |
||
61 | */ |
||
62 | public function testHasClearAllButton() |
||
63 | { |
||
64 | $this->assertInstanceOf( |
||
65 | GridFieldClearAllButton::class, |
||
66 | $this->getConfig()->getComponentByType(GridFieldClearAllButton::class) |
||
67 | ); |
||
68 | } |
||
69 | |||
70 | /** |
||
71 | * Test that the entry and level fields are displayed in the GridField, and can be exported |
||
72 | */ |
||
73 | public function testEntryAndLevelShouldBeInSummaryFields() |
||
79 | |||
80 | /** |
||
81 | * Get the test GridField's config class |
||
82 | * |
||
83 | * @return \SilverStripe\Forms\GridField\GridFieldConfig |
||
84 | */ |
||
85 | protected function getConfig() |
||
93 | } |
||
94 |