3
* Spring Signage Ltd - http://www.springsignage.com
4
* Copyright (C) 2017-18 Spring Signage Ltd
5
* (DataSetDataEditTest.php)
9
namespace Xibo\Tests\integration\Cache;
12
use Xibo\Entity\DataSetColumn;
13
use Xibo\Entity\Display;
14
use Xibo\Helper\Random;
15
use Xibo\OAuth2\Client\Entity\XiboDataSet;
16
use Xibo\OAuth2\Client\Entity\XiboDataSetColumn;
17
use Xibo\OAuth2\Client\Entity\XiboDataSetView;
18
use Xibo\OAuth2\Client\Entity\XiboDisplay;
19
use Xibo\OAuth2\Client\Entity\XiboLayout;
20
use Xibo\OAuth2\Client\Entity\XiboSchedule;
21
use Xibo\OAuth2\Client\Entity\XiboWidget;
22
use Xibo\Tests\Helper\DisplayHelperTrait;
23
use Xibo\Tests\Helper\LayoutHelperTrait;
24
use Xibo\Tests\LocalWebTestCase;
27
* Class DataSetDataEditTest
28
* @package Xibo\Tests\integration\Cache
30
class DataSetDataEditTest extends LocalWebTestCase
32
use LayoutHelperTrait;
33
use DisplayHelperTrait;
35
/** @var XiboDataSet */
38
/** @var DataSetColumn */
39
protected $dataSetColumn;
41
/** @var XiboLayout */
44
/** @var XiboWidget */
47
/** @var XiboDisplay */
50
// <editor-fold desc="Init">
51
public function setup()
55
$this->getLogger()->debug('Setup test for Cache ' . get_class() .' Test');
58
$this->dataSet = (new XiboDataSet($this->getEntityProvider()))->create(Random::generateString(), 'Test');
61
$this->dataSetColumn = (new XiboDataSetColumn($this->getEntityProvider()))->create($this->dataSet->dataSetId,
62
Random::generateString(),
70
$this->layout = $this->createLayout();
72
// Add a couple of text widgets to the region
73
$response = $this->getEntityProvider()->post('/playlist/widget/datasetview/' . $this->layout->regions[0]->playlists[0]['playlistId'], [
74
'name' => Random::generateString(),
75
'dataSetId' => $this->dataSet->dataSetId,
80
$this->widget = (new XiboDataSetView($this->getEntityProvider()))->hydrate($response);
82
// Set the Layout status
83
$this->setLayoutStatus($this->layout, 1);
86
$this->display = $this->createDisplay();
88
// Schedule the Layout "always" onto our display
89
// deleting the layout will remove this at the end
90
$event = (new XiboSchedule($this->getEntityProvider()))->createEventLayout(
91
date('Y-m-d H:i:s', time()+3600),
92
date('Y-m-d H:i:s', time()+7200),
93
$this->layout->campaignId,
94
[$this->display->displayGroupId],
103
$this->displaySetStatus($this->display, Display::$STATUS_DONE);
106
public function tearDown()
110
// Delete the Layout we've been working with
111
$this->deleteLayout($this->layout);
113
// Delete the DataSet
114
$this->dataSet->deleteWData();
116
// Delete the Display
117
$this->deleteDisplay($this->display);
122
* @group cacheInvalidateTests
124
public function testInvalidateCache()
126
// Add Data to the DataSet
127
$this->client->post('/dataset/data/'. $this->dataSet->dataSetId, [
128
'dataSetColumnId_' . $this->dataSetColumn->dataSetColumnId => '1'
131
// Validate the display status afterwards
132
$this->assertTrue($this->displayStatusEquals($this->display, Display::$STATUS_PENDING), 'Display Status isnt as expected');
134
// Somehow test that we have issued an XMR request
135
$this->assertTrue(in_array($this->display->displayId, $this->getPlayerActionQueue()), 'Player action not present');
b'\\ No newline at end of file'