Scalr\Tests\Functional\Ui\Controller\EnvironmentsTest::testXCreateAction PHP Метод

testXCreateAction() публичный Метод

public testXCreateAction ( )
    public function testXCreateAction()
    {
        if (!$this->getUser()->isAccountOwner()) {
            $this->markTestSkipped("Specified test user is not allowed to create environments. It should be account owner.");
        }
        $createdEnvironmentName = self::getTestName(self::ENV_NAME);
        $res = $this->internalRequest('/environments/xCreate', array('name' => $createdEnvironmentName));
        $this->assertArrayHasKey('success', $res);
        $this->assertArrayHasKey('env', $res);
        $this->assertInternalType('array', $res['env']);
        $this->assertArrayHasKey('name', $res['env']);
        $this->assertArrayHasKey('id', $res['env']);
        $this->assertEquals(true, $res['success']);
        $this->assertEquals($createdEnvironmentName, $res['env']['name']);
        $createdEnvId = $res['env']['id'];
        $this->assertNotEmpty($createdEnvId);
        //Test saving
        $par = \Scalr_Environment::SETTING_TIMEZONE;
        $res2 = $this->internalRequest('/environments/xSave', array('envId' => $createdEnvId, $par => 'Europe/Simferopol'));
        $this->assertTrue(isset($res2['success']) && $res2['success']);
        //Test removal
        $this->_removeTestEnv($createdEnvId);
    }