. */ namespace Xibo\Tests\integration\Cache; use Xibo\Entity\Display; use Xibo\OAuth2\Client\Entity\XiboDisplay; use Xibo\OAuth2\Client\Entity\XiboLayout; use Xibo\Tests\Helper\DisplayHelperTrait; use Xibo\Tests\Helper\LayoutHelperTrait; use Xibo\Tests\LocalWebTestCase; /** * Class LayoutChangeActionTest * * Tests whether a Layout Edit updates the Cache Appropriately * * @package integration\Cache */ class LayoutChangeActionTest extends LocalWebTestCase { use LayoutHelperTrait; use DisplayHelperTrait; /** @var XiboLayout */ protected $layout; /** @var XiboDisplay */ protected $display; // public function setup() { parent::setup(); $this->getLogger()->debug('Setup test for Cache Layout Edit Test'); // Create a Layout $this->layout = $this->createLayout(1); // Create a Display $this->display = $this->createDisplay(); $this->displaySetStatus($this->display, Display::$STATUS_DONE); } public function tearDown() { parent::tearDown(); // Delete the Layout we've been working with $this->deleteLayout($this->layout); // Delete the Display $this->deleteDisplay($this->display); } // /** * @group cacheInvalidateTests */ public function testInvalidateCache() { // Make sure we're in good condition to start $this->assertTrue($this->displayStatusEquals($this->display, Display::$STATUS_DONE), 'Display Status isnt as expected'); // Edit the Layout $this->sendRequest('POST','/displaygroup/' . $this->display->displayGroupId . '/action/changeLayout', [ 'layoutId' => $this->layout->layoutId ]); // Validate the display status afterwards $this->assertTrue($this->displayStatusEquals($this->display, Display::$STATUS_PENDING), 'Display Status isnt as expected'); // Somehow test that we have issued an XMR request $this->assertTrue(in_array($this->display->displayId, $this->getPlayerActionQueue()), 'Player action not present'); } }