1 | <?php |
||
18 | class LogEntryTest extends SapphireTest |
||
19 | { |
||
20 | |||
21 | /** |
||
22 | * Test the gridfield Summary method |
||
23 | */ |
||
24 | public function testGridfieldSummary() |
||
25 | { |
||
26 | $shortString = 'abcdefghijklmnopqrstuvwxyz'; |
||
27 | $longString = ''; |
||
28 | // Generate a string of 350 characters. Because we don't care about the actual content |
||
29 | // A set of a's is good enough; |
||
30 | for ($i = 0; $i <= 350; $i++) { |
||
31 | $longString .= 'a'; |
||
32 | } |
||
33 | $logEntry = LogEntry::create(); |
||
34 | $logEntry->Entry = $shortString; |
||
35 | $this->assertEquals($shortString, $logEntry->getGridfieldSummary()); |
||
36 | $logEntry->Entry = $longString; |
||
37 | $elipsisString = substr($longString, 0, 300) . '...'; |
||
38 | $this->assertEquals($elipsisString, $logEntry->getGridfieldSummary()); |
||
39 | $this->assertEquals($longString, $logEntry->getGridfieldSummary(351)); |
||
40 | } |
||
41 | |||
42 | /** |
||
43 | * Test if the fields are in the fieldlist |
||
44 | * A literal field is returning null in getCMSFields. |
||
45 | */ |
||
46 | public function testGetCMSFieldsFormattedEntry() |
||
56 | |||
57 | /** |
||
58 | * Test if the field shows when not formatting |
||
59 | */ |
||
60 | public function testGetCMSFieldsUnformattedEntry() |
||
71 | |||
72 | /** |
||
73 | * Test the entire build of a formatted entry |
||
74 | */ |
||
75 | public function testBuildEntry() |
||
94 | } |
||
95 |