3
* Spring Signage Ltd - http://www.springsignage.com
4
* Copyright (C) 2017-18 Spring Signage Ltd
5
* (ScheduleChangeInsideRfTest.php)
9
namespace Xibo\Tests\integration\Cache;
11
use Xibo\Entity\Display;
12
use Xibo\OAuth2\Client\Entity\XiboDisplay;
13
use Xibo\OAuth2\Client\Entity\XiboLayout;
14
use Xibo\OAuth2\Client\Entity\XiboSchedule;
15
use Xibo\OAuth2\Client\Entity\XiboText;
16
use Xibo\OAuth2\Client\Entity\XiboTicker;
17
use Xibo\Tests\Helper\DisplayHelperTrait;
18
use Xibo\Tests\Helper\LayoutHelperTrait;
19
use Xibo\Tests\LocalWebTestCase;
22
* Class ScheduleChangeInsideRfTest
23
* @package Xibo\Tests\integration\Cache
25
class ScheduleChangeInsideRfTest extends LocalWebTestCase
27
use LayoutHelperTrait;
28
use DisplayHelperTrait;
30
/** @var XiboLayout */
33
/** @var XiboDisplay */
36
/** @var XiboTicker */
39
/** @var XiboSchedule */
42
// <editor-fold desc="Init">
43
public function setup()
47
$this->getLogger()->debug('Setup test for Cache ' . get_class() .' Test');
50
$this->layout = $this->createLayout();
52
$response = $this->getEntityProvider()->post('/playlist/widget/text/' . $this->layout->regions[0]->playlists[0]['playlistId'], [
58
$this->widget = (new XiboText($this->getEntityProvider()))->hydrate($response);
61
$this->buildLayout($this->layout);
64
$this->display = $this->createDisplay();
66
// Schedule the Layout "always" onto our display
67
// deleting the layout will remove this at the end
68
$this->event = (new XiboSchedule($this->getEntityProvider()))->createEventLayout(
69
date('Y-m-d H:i:s', time()+3600),
70
date('Y-m-d H:i:s', time()+7200),
71
$this->layout->campaignId,
72
[$this->display->displayGroupId],
81
$this->displaySetStatus($this->display, Display::$STATUS_DONE);
82
$this->displaySetLicensed($this->display);
84
$this->getLogger()->debug('Finished Setup');
87
public function tearDown()
89
$this->getLogger()->debug('Tear Down');
93
// Delete the Layout we've been working with
94
$this->deleteLayout($this->layout);
97
$this->deleteDisplay($this->display);
102
* @group cacheInvalidateTests
104
public function testInvalidateCache()
106
// Make sure our Layout is already status 1
107
$this->assertTrue($this->layoutStatusEquals($this->layout, 1), 'Layout Status isnt as expected');
109
// Make sure our Display is already DONE
110
$this->assertTrue($this->displayStatusEquals($this->display, Display::$STATUS_DONE), 'Display Status isnt as expected');
112
// Change the Schedule
113
$this->client->put('/schedule/' . $this->event->eventId, [
114
'fromDt' => date('Y-m-d H:i:s', $this->event->fromDt),
115
'toDt' => date('Y-m-d H:i:s', $this->event->toDt),
117
'campaignId' => $this->event->campaignId,
118
'displayGroupIds' => [$this->display->displayGroupId],
121
], ['CONTENT_TYPE' => 'application/x-www-form-urlencoded']);
123
// Check the Layout Status
124
// Validate the layout status afterwards
125
$this->assertTrue($this->layoutStatusEquals($this->layout, 1), 'Layout Status isnt as expected');
127
// Validate the display status afterwards
128
$this->assertTrue($this->displayStatusEquals($this->display, Display::$STATUS_PENDING), 'Display Status isnt as expected');
130
// Validate that XMR has been called.
131
$this->assertTrue(in_array($this->display->displayId, $this->getPlayerActionQueue()), 'Player action not present');
b'\\ No newline at end of file'