~xibo-maintainers/xibo/tempel

« back to all changes in this revision

Viewing changes to tests/integration/Cache/ScheduleChangeInsideRfTest.php

  • Committer: Dan Garner
  • Date: 2016-02-04 14:13:07 UTC
  • mto: (454.4.101)
  • mto: This revision was merged to the branch mainline in revision 483.
  • Revision ID: git-v1:f9078f575b16a62a51e2f3d7bc15581058fb0747
Problem with DataSet form putting a 0 in library image references (should be empty)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<?php
2
 
/*
3
 
 * Spring Signage Ltd - http://www.springsignage.com
4
 
 * Copyright (C) 2017-18 Spring Signage Ltd
5
 
 * (ScheduleChangeInsideRfTest.php)
6
 
 */
7
 
 
8
 
 
9
 
namespace Xibo\Tests\integration\Cache;
10
 
 
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;
20
 
 
21
 
/**
22
 
 * Class ScheduleChangeInsideRfTest
23
 
 * @package Xibo\Tests\integration\Cache
24
 
 */
25
 
class ScheduleChangeInsideRfTest extends LocalWebTestCase
26
 
{
27
 
    use LayoutHelperTrait;
28
 
    use DisplayHelperTrait;
29
 
 
30
 
    /** @var XiboLayout */
31
 
    protected $layout;
32
 
 
33
 
    /** @var XiboDisplay */
34
 
    protected $display;
35
 
 
36
 
    /** @var XiboTicker */
37
 
    protected $widget;
38
 
 
39
 
    /** @var XiboSchedule */
40
 
    protected $event;
41
 
 
42
 
    // <editor-fold desc="Init">
43
 
    public function setup()
44
 
    {
45
 
        parent::setup();
46
 
 
47
 
        $this->getLogger()->debug('Setup test for Cache ' . get_class() .' Test');
48
 
 
49
 
        // Create a Layout
50
 
        $this->layout = $this->createLayout();
51
 
 
52
 
        $response = $this->getEntityProvider()->post('/playlist/widget/text/' . $this->layout->regions[0]->playlists[0]['playlistId'], [
53
 
            'text' => 'Widget A',
54
 
            'duration' => 100,
55
 
            'useDuration' => 1
56
 
        ]);
57
 
 
58
 
        $this->widget = (new XiboText($this->getEntityProvider()))->hydrate($response);
59
 
 
60
 
        // Build the layout
61
 
        $this->buildLayout($this->layout);
62
 
 
63
 
        // Create a Display
64
 
        $this->display = $this->createDisplay();
65
 
 
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],
73
 
            0,
74
 
            NULL,
75
 
            NULL,
76
 
            NULL,
77
 
            0,
78
 
            0
79
 
        );
80
 
 
81
 
        $this->displaySetStatus($this->display, Display::$STATUS_DONE);
82
 
        $this->displaySetLicensed($this->display);
83
 
 
84
 
        $this->getLogger()->debug('Finished Setup');
85
 
    }
86
 
 
87
 
    public function tearDown()
88
 
    {
89
 
        $this->getLogger()->debug('Tear Down');
90
 
 
91
 
        parent::tearDown();
92
 
 
93
 
        // Delete the Layout we've been working with
94
 
        $this->deleteLayout($this->layout);
95
 
 
96
 
        // Delete the Display
97
 
        $this->deleteDisplay($this->display);
98
 
    }
99
 
    // </editor-fold>
100
 
 
101
 
    /**
102
 
     * @group cacheInvalidateTests
103
 
     */
104
 
    public function testInvalidateCache()
105
 
    {
106
 
        // Make sure our Layout is already status 1
107
 
        $this->assertTrue($this->layoutStatusEquals($this->layout, 1), 'Layout Status isnt as expected');
108
 
 
109
 
        // Make sure our Display is already DONE
110
 
        $this->assertTrue($this->displayStatusEquals($this->display, Display::$STATUS_DONE), 'Display Status isnt as expected');
111
 
 
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),
116
 
            'eventTypeId' => 1,
117
 
            'campaignId' => $this->event->campaignId,
118
 
            'displayGroupIds' => [$this->display->displayGroupId],
119
 
            'displayOrder' => 1,
120
 
            'isPriority' => 1
121
 
        ], ['CONTENT_TYPE' => 'application/x-www-form-urlencoded']);
122
 
 
123
 
        // Check the Layout Status
124
 
        // Validate the layout status afterwards
125
 
        $this->assertTrue($this->layoutStatusEquals($this->layout, 1), 'Layout Status isnt as expected');
126
 
 
127
 
        // Validate the display status afterwards
128
 
        $this->assertTrue($this->displayStatusEquals($this->display, Display::$STATUS_PENDING), 'Display Status isnt as expected');
129
 
 
130
 
        // Validate that XMR has been called.
131
 
        $this->assertTrue(in_array($this->display->displayId, $this->getPlayerActionQueue()), 'Player action not present');
132
 
    }
133
 
}
 
 
b'\\ No newline at end of file'