<commit_before><?php
/**
 * Created by JetBrains PhpStorm.
 * User: martinhalamicek
 * Date: 22/05/14
 * Time: 16:38
 * To change this template use File | Settings | File Templates.
 */

namespace Keboola\Test\Common;

use Keboola\Test\StorageApiTestCase;

class ComponentsPublishTest extends StorageApiTestCase
{


    public function setUp()
    {
        parent::setUp();

        $components = new \Keboola\StorageApi\Components($this->_client);
        foreach ($components->listComponents() as $component) {
            foreach ($component['configurations'] as $configuration) {
                $components->deleteConfiguration($component['id'], $configuration['id']);
            }
        }
    }

    public function testConfigurationPublish()
    {
        $componentId = 'wr-db';
        $configurationId = 'main-1';
        $configOptions = (new \Keboola\StorageApi\Options\Components\Configuration())<commit_msg>fix tests - delete deleted configurations<commit_after><?php
/**
 * Created by JetBrains PhpStorm.
 * User: martinhalamicek
 * Date: 22/05/14
 * Time: 16:38
 * To change this template use File | Settings | File Templates.
 */

namespace Keboola\Test\Common;

use Keboola\Test\StorageApiTestCase;

class ComponentsPublishTest extends StorageApiTestCase
{


    public function setUp()
    {
        parent::setUp();

        $components = new \Keboola\StorageApi\Components($this->_client);
        foreach ($components->listComponents() as $component) {
            foreach ($component['configurations'] as $configuration) {
                $components->deleteConfiguration($component['id'], $configuration['id']);
            }
        }

        // erase all deleted configurations
        $index = $this->_client->indexAction();
        foreach ($index['components'] as $component) {
            $listOptions = new ListComponentConfigurationsOptions();
            $listOptions->setComponentId($component['id']);
            $listOptions->setIsDeleted(true);

            foreach ($components->listComponentConfigurations($listOptions) as $configuration) {
                $components->deleteConfiguration($component['id'], $configuration['id']);
            }
        }
    }

    public function testConfigurationPublish()
    {
        $componentId = 'wr-db';
        $configurationId = 'main-1';
        $configOptions = (new \Keboola\StorageApi\Options\Components\Configuration())
{'fraction_non_alphanumeric': 0.1255698300870286, 'fraction_numerical': 0.009117281392457521, 'mean_word_length': 2.9769357495881383, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5885793', 'n_tokens_mistral': 658, 'n_tokens_neox': 632, 'n_words': 134}