3
* Spring Signage Ltd - http://www.springsignage.com
4
* Copyright (C) 2017 Spring Signage Ltd
9
namespace Xibo\Tests\integration\Cache;
12
use Xibo\Entity\Display;
13
use Xibo\OAuth2\Client\Entity\XiboDisplay;
14
use Xibo\OAuth2\Client\Entity\XiboLayout;
15
use Xibo\OAuth2\Client\Entity\XiboSchedule;
16
use Xibo\Tests\Helper\DisplayHelperTrait;
17
use Xibo\Tests\Helper\LayoutHelperTrait;
18
use Xibo\Tests\LocalWebTestCase;
21
* Class LayoutEditTest
23
* Tests whether a Layout Edit updates the Cache Appropriately
25
* @package integration\Cache
27
class LayoutEditTest extends LocalWebTestCase
29
use LayoutHelperTrait;
30
use DisplayHelperTrait;
32
/** @var XiboLayout */
35
/** @var XiboDisplay */
38
// <editor-fold desc="Init">
39
public function setup()
43
$this->getLogger()->debug('Setup test for Cache Layout Edit Test');
46
$this->layout = $this->createLayout(1);
49
$this->display = $this->createDisplay();
51
// Schedule the Layout "always" onto our display
52
// deleting the layout will remove this at the end
53
$event = (new XiboSchedule($this->getEntityProvider()))->createEventLayout(
54
date('Y-m-d H:i:s', time()+3600),
55
date('Y-m-d H:i:s', time()+7200),
56
$this->layout->campaignId,
57
[$this->display->displayGroupId],
66
$this->displaySetStatus($this->display, Display::$STATUS_DONE);
69
public function tearDown()
73
// Delete the Layout we've been working with
74
$this->deleteLayout($this->layout);
77
$this->deleteDisplay($this->display);
82
* @group cacheInvalidateTests
84
public function testInvalidateCache()
86
// Make sure we're in good condition to start
87
$this->assertTrue($this->displayStatusEquals($this->display, Display::$STATUS_DONE), 'Display Status isnt as expected');
90
$this->client->put('/layout/' . $this->layout->layoutId, [
91
'name' => $this->layout->layout,
92
'description' => $this->layout->description,
93
'backgroundColor' => $this->layout->backgroundColor,
94
'backgroundzIndex' => $this->layout->backgroundzIndex
95
], ['CONTENT_TYPE' => 'application/x-www-form-urlencoded']);
97
// Validate the layout status afterwards
98
$this->assertTrue($this->layoutStatusEquals($this->layout, 3), 'Layout Status isnt as expected');
100
// Validate the display status afterwards
101
$this->assertTrue($this->displayStatusEquals($this->display, Display::$STATUS_DONE), 'Display Status isnt as expected');
103
// Somehow test that we have issued an XMR request
104
$this->assertFalse(in_array($this->display->displayId, $this->getPlayerActionQueue()), 'Player action not present');
b'\\ No newline at end of file'