<commit_before><?php

namespace OpenOrchestra\ApiBundle\Tests\Functional\Controller;

/**
 * Class AreaControllerTest
 */
class AreaControllerTest extends AbstractControllerTest
{
    /**
     * test reverse transform
     */
    public function testAreaReverseTransform()
    {
        $this->client->request('GET', '/admin/homepage/1/en');
        $this->assertEquals(200, $this->client->getResponse()->getStatusCode());

        $this->client->request('GET', '/api/node/root');
        $this->assertEquals(200, $this->client->getResponse()->getStatusCode());

        $json = json_decode($this->client->getResponse()->getContent(), true);
        $area = $json['areas'][0];
        $this->assertSame('main', $area['area_id']);
        $block = $area['blocks'][3];
        $update = $area['links']['_self_block'];


        // Remove ref of area in block 3
        $formData = json_encode(array('blocks' => array(
            array('node_id' => 'root', 'block_id' => 0),
            array('node_id' => 'root', 'block_id' => 1),
            array('node_id' => 'root', 'block_id' => 2),
        )));

        $this->client->request('POST', $update, array(), array(), array(), $formData);
        $this->assertEquals(200, $this->client->getResponse()->getStatusCode());

        $language = $this->currentSiteManager->getCurrentSiteDefaultLanguage();
        $siteId = $this->currentSiteManager->getCurrentSiteId();
        $nodeAfter = $this->nodeRepository->findOneByNodeIdAndLanguageAndSiteIdAndLastVersion($block['node_id'], $language, $siteId);
        $this->assertSame(array(), $nodeAfter->getBlock(3)->getAreas());

        // Add ref of area in block 3
        $formData = json_encode(array('blocks' => array(
            array('node_id' => 'root', 'block_id' => 0),
            array('node_id' => 'root', 'block_id' => 1),
            array('node_id' => 'root', 'block_id' => 2),
            array('node_id' => 'root', 'block_id' => 3),
        )));

        $this->client->request('POST', $update, array(), array(), array(), $formData);
        $this->assertEquals(200, $this->client->getResponse()->getStatusCode());
    }
}
<commit_msg>fix tests<commit_after><?php

namespace OpenOrchestra\ApiBundle\Tests\Functional\Controller;

/**
 * Class AreaControllerTest
 */
class AreaControllerTest extends AbstractControllerTest
{
    /**
     * test reverse transform
     */
    public function testAreaReverseTransform()
    {
        $this->client->request('GET', '/admin/1/homepage/en');
        $this->assertEquals(200, $this->client->getResponse()->getStatusCode());

        $this->client->request('GET', '/api/node/root');
        $this->assertEquals(200, $this->client->getResponse()->getStatusCode());

        $json = json_decode($this->client->getResponse()->getContent(), true);
        $area = $json['areas'][0];
        $this->assertSame('main', $area['area_id']);
        $block = $area['blocks'][3];
        $update = $area['links']['_self_block'];


        // Remove ref of area in block 3
        $formData = json_encode(array('blocks' => array(
            array('node_id' => 'root', 'block_id' => 0),
            array('node_id' => 'root', 'block_id' => 1),
            array('node_id' => 'root', 'block_id' => 2),
        )));

        $this->client->request('POST', $update, array(), array(), array(), $formData);
        $this->assertEquals(200, $this->client->getResponse()->getStatusCode());

        $language = $this->currentSiteManager->getCurrentSiteDefaultLanguage();
        $siteId = $this->currentSiteManager->getCurrentSiteId();
        $nodeAfter = $this->nodeRepository->findOneByNodeIdAndLanguageAndSiteIdAndLastVersion($block['node_id'], $language, $siteId);
        $this->assertSame(array(), $nodeAfter->getBlock(3)->getAreas());

        // Add ref of area in block 3
        $formData = json_encode(array('blocks' => array(
            array('node_id' => 'root', 'block_id' => 0),
            array('node_id' => 'root', 'block_id' => 1),
            array('node_id' => 'root', 'block_id' => 2),
            array('node_id' => 'root', 'block_id' => 3),
        )));

        $this->client->request('POST', $update, array(), array(), array(), $formData);
        $this->assertEquals(200, $this->client->getResponse()->getStatusCode());
    }
}

{'fraction_non_alphanumeric': 0.1989748369058714, 'fraction_numerical': 0.011649580615097856, 'mean_word_length': 3.208823529411765, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 109, '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': '1460795', 'n_tokens_mistral': 1294, 'n_tokens_neox': 1261, 'n_words': 217}