. */ namespace Xibo\Tests\integration; use Xibo\OAuth2\Client\Entity\XiboLayout; use Xibo\Tests\Helper\LayoutHelperTrait; use Xibo\Tests\LocalWebTestCase; /** * Class LayoutDraftTest * @package Xibo\Tests\integration */ class LayoutDraftTest extends LocalWebTestCase { use LayoutHelperTrait; /** @var XiboLayout */ private $layout; public function setup() { parent::setup(); $this->layout = $this->createLayout(); } public function tearDown() { parent::tearDown(); // This should always be the original, regardless of whether we checkout/discard/etc $this->layout->delete(); } /** * Test adding a region to a Layout that has been checked out, but use the parent */ public function testAddRegionCheckoutParent() { // Add region to our layout with data from regionSuccessCases $response = $this->sendRequest('POST','/region/' . $this->layout->layoutId, [ 'width' => 100, 'height' => 100, 'top' => 10, 'left' => 10 ]); $this->assertSame(422, $response->getStatusCode(), 'Status Incorrect'); $object = json_decode($response->getBody()); $this->assertSame(false, $object->success); $this->assertSame(422, $object->httpStatus); } /** * Test adding a region to a Layout that has been checked out, using the draft */ public function testAddRegionCheckout() { // Checkout the Parent, but add a Region to the Original $layout = $this->getDraft($this->layout); // Add region to our layout with data from regionSuccessCases $response = $this->sendRequest('POST','/region/' . $layout->layoutId, [ 'width' => 100, 'height' => 100, 'top' => 10, 'left' => 10 ]); $this->assertSame(200, $response->getStatusCode(), $response->getBody()); } }