. */ namespace Xibo\Tests\integration\Widget; use Xibo\OAuth2\Client\Entity\XiboLayout; use Xibo\Tests\Helper\LayoutHelperTrait; use Xibo\Tests\LocalWebTestCase; /** * Class WidgetOnDraftsTest * @package Xibo\Tests\integration\Widget */ class WidgetOnDraftsTest extends LocalWebTestCase { use LayoutHelperTrait; /** @var XiboLayout */ private $layout; public function setup() { parent::setup(); $this->layout = $this->createLayout(); } public function tearDown() { // This should always be the original, regardless of whether we checkout/discard/etc $this->layout->delete(); parent::tearDown(); } /** * Test to try and add a widget to a Published Layout */ public function testEditPublished() { // Get my Playlist $playlistId = $this->layout->regions[0]->regionPlaylist->playlistId; // Add a widget (any widget will do, it doesn't matter) $response = $this->sendRequest('POST','/playlist/widget/localVideo/' . $playlistId); $this->getLogger()->debug('Response from Widget Add is ' . $response->getBody()->getContents()); $this->assertSame(422, $response->getStatusCode(), $response->getBody()); } /** * Test to try and add a widget to a Published Layout */ public function testEditDraft() { // Checkout the Layout $layout = $this->getDraft($this->layout); // Get my Playlist $playlistId = $layout->regions[0]->regionPlaylist->playlistId; // Add a widget (any widget will do, it doesn't matter) $response = $this->sendRequest('POST','/playlist/widget/localVideo/' . $playlistId); $this->getLogger()->debug('Response from Widget Add is ' . $response->getBody()->getContents()); $this->assertSame(200, $response->getStatusCode(), $response); } }