GcDevelopment\Controller\DocumentTypeControllerTest::testEditActionWithPostData PHP Method

testEditActionWithPostData() public method

Test
public testEditActionWithPostData ( ) : void
return void
    public function testEditActionWithPostData()
    {
        $viewModel = ViewModel::fromArray(array('name' => 'Test', 'identifier' => 'Test', 'content' => 'Test'));
        $viewModel->save();
        $datatypeModel = DatatypeModel::fromArray(array('name' => 'DatatypeTest', 'model' => 'Textstring'));
        $datatypeModel->save();
        $documentTypeModel = DocumentTypeModel::fromArray(array('name' => 'TestDocumentType', 'icon_id' => 3, 'default_view_id' => $viewModel->getId(), 'user_id' => $this->user->getId()));
        $documentTypeModel->save();
        $tabModel = TabModel::fromArray(array('name' => 'test', 'description' => 'test', 'document_type_id' => $documentTypeModel->getId()));
        $tabModel->save();
        $propertyModel = PropertyModel::fromArray(array('name' => 'test', 'identifier' => 'test', 'description' => 'test', 'tab_id' => $tabModel->getId(), 'datatype_id' => $datatypeModel->getId()));
        $propertyModel->save();
        $this->dispatch('/admin/development/document-type/edit/' . $documentTypeModel->getId(), 'POST', array('infos' => array('icon_id' => 3, 'name' => 'TestDocumentType'), 'views' => array('default_view' => $viewModel->getId()), 'properties' => array('property1' => array('datatype' => $datatypeModel->getId(), 'identifier' => 'test', 'description' => 'test', 'name' => 'test', 'tab' => 21), 'wrongId' => array('datatype' => $datatypeModel->getId(), 'identifier' => 'test', 'description' => 'test', 'name' => 'test', 'tab' => 21)), 'tabs' => array('tab21' => array('description' => 'test', 'name' => 'test'), 'wrongId' => array('description' => 'test', 'name' => 'test'))));
        $this->assertResponseStatusCode(302);
        $this->assertModuleName('GcDevelopment');
        $this->assertControllerName('DocumentTypeController');
        $this->assertControllerClass('DocumentTypeController');
        $this->assertMatchedRouteName('development/document-type/edit');
        $documentTypeModel->delete();
        $propertyModel->delete();
        $tabModel->delete();
        $viewModel->delete();
        $datatypeModel->delete();
    }