[TASK] Migrate ext:belog to extbase
[Packages/TYPO3.CMS.git] / typo3 / sysext / belog / Tests / Unit / Domain / Model / LogEntryTest.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 2012 Oliver Klee <typo3-coding@oliverklee.de>
6 * All rights reserved
7 *
8 * This script is part of the TYPO3 project. The TYPO3 project is
9 * free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * The GNU General Public License can be found at
15 * http://www.gnu.org/copyleft/gpl.html.
16 *
17 * This script is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * This copyright notice MUST APPEAR in all copies of the script!
23 ***************************************************************/
24
25 /**
26 * Testcase for the Tx_Belog_Domain_Model_LogEntry class.
27 *
28 * @author Oliver Klee <typo3-coding@oliverklee.de>
29 * @package TYPO3
30 * @subpackage belog
31 */
32 class Tx_Belog_Domain_Repository_LogEntryTest extends Tx_Extbase_Tests_Unit_BaseTestCase {
33 /**
34 * @var Tx_Belog_Domain_Model_LogEntry
35 */
36 private $fixture = NULL;
37
38 public function setUp() {
39 $this->fixture = new Tx_Belog_Domain_Model_LogEntry();
40 }
41
42 public function tearDown() {
43 unset($this->fixture);
44 }
45
46 /**
47 * @test
48 */
49 public function getLogDataInitiallyReturnsEmptyArray() {
50 $this->assertSame(
51 array(),
52 $this->fixture->getLogData()
53 );
54 }
55
56 /**
57 * @test
58 */
59 public function getLogDataForEmptyStringLogDataReturnsEmptyArray() {
60 $this->fixture->setLogData('');
61
62 $this->assertSame(
63 array(),
64 $this->fixture->getLogData()
65 );
66 }
67
68 /**
69 * @test
70 */
71 public function getLogDataForGarbageStringLogDataReturnsEmptyArray() {
72 $this->fixture->setLogData('foo bar');
73
74 $this->assertSame(
75 array(),
76 $this->fixture->getLogData()
77 );
78 }
79
80 /**
81 * @test
82 */
83 public function getLogDataForSerializedArrayReturnsThatArray() {
84 $logData = array('foo', 'bar');
85
86 $this->fixture->setLogData(serialize($logData));
87
88 $this->assertSame(
89 $logData,
90 $this->fixture->getLogData()
91 );
92 }
93
94 /**
95 * @test
96 */
97 public function getLogDataForSerializedObjectReturnsEmptyArray() {
98 $this->fixture->setLogData(new stdClass());
99
100 $this->assertSame(
101 array(),
102 $this->fixture->getLogData()
103 );
104 }
105 }
106 ?>