TYPO3 CMS  TYPO3_6-2
ActionHandlerTest.php
Go to the documentation of this file.
1 <?php
3 
4 /*
5  * This file is part of the TYPO3 CMS project.
6  *
7  * It is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU General Public License, either version 2
9  * of the License, or any later version.
10  *
11  * For the full copyright and license information, please read the
12  * LICENSE.txt file that was distributed with this source code.
13  *
14  * The TYPO3 project - inspiring people to share!
15  */
16 
18 
23 
24  protected $coreExtensionsToLoad = array('version', 'workspaces');
25 
31  public function setUp() {
32  parent::setUp();
33  $this->setUpBackendUserFromFixture(1);
34  \TYPO3\CMS\Core\Core\Bootstrap::getInstance()->initializeLanguageObject();
35  }
36 
41  $actionHandler = new \TYPO3\CMS\Workspaces\ExtDirect\ActionHandler();
42 
43  $this->importDataSet(__DIR__ . '/Fixtures/pages.xml');
44  $this->importDataSet(__DIR__ . '/Fixtures/sys_workspace.xml');
45  $this->importDataSet(__DIR__ . '/Fixtures/tt_content.xml');
46 
47  // Prepare parameter
48  $parameter = new \stdClass();
49  $parameter->additional = '';
50  $parameter->receipients = array();
51  $parameter->comments = '';
52 
53  // Send to LIVE
54  $parameter->affects = new \stdClass();
55  $parameter->affects->nextStage = -20;
56  $parameter->affects->elements = array();
57 
58  // First and only affected element
59  $elementOne = new \stdClass();
60  $elementOne->table = 'tt_content';
61  $elementOne->uid = 2;
62  $elementOne->t3ver_oid = 1;
63  $parameter->affects->elements[] = $elementOne;
64 
65  $recordBeforePublish = BackendUtility::getRecord('tt_content', 2);
66  $this->assertEquals($recordBeforePublish['header'], 'Workspace version of original content');
67 
68  // First publish
69  $result = $actionHandler->sendToSpecificStageExecute($parameter);
70  $this->assertTrue($result['success']);
71  $recordAfterFirstPublish = BackendUtility::getRecord('tt_content', 2);
72 
73  $this->assertEquals($recordAfterFirstPublish['t3ver_wsid'], 0);
74  $this->assertEquals($recordAfterFirstPublish['header'], 'Original content');
75 
76  // Second publish
77  $result = $actionHandler->sendToSpecificStageExecute($parameter);
78  $this->assertTrue($result['success']);
79  $recordAfterSecondPublish = BackendUtility::getRecord('tt_content', 2);
80 
81  // In case of an error, this will again be "Workspace version of original content"
82  $this->assertEquals($recordAfterSecondPublish['t3ver_wsid'], 0);
83  $this->assertEquals($recordAfterSecondPublish['header'], 'Original content');
84  }
85 }
if($list_of_literals) if(!empty($literals)) if(!empty($literals)) $result
Analyse literals to prepend the N char to them if their contents aren&#39;t numeric.