<commit_before><?php

namespace Backpack\CRUD\Tests\Unit\CrudPanel;

class CrudPanelColumnsTest extends BaseCrudPanelTest
{
    private $oneColumnArray = [
        'name' => 'column1',
        'label' => 'Column1',
    ];

    private $otherOneColumnArray = [
        'name' => 'column4',
        'label' => 'Column4',
    ];

    private $twoColumnsArray = [
        [
            'name' => 'column1',
            'label' => 'Column1',
        ],
        [
            'name' => 'column2',
            'label' => 'Column2',
        ],
    ];

    private $expectedTwoColumnsArray = [
        'column1' => [
            'name' => 'column1',
            'label' => 'Column1',
        ],
        'column2' => [
            'name' => 'column2',
            'label' => 'Column2',
        ],
    ];

    private $threeColumnsArray = [
        [
            'name' => 'column1',
            'label' => 'Column1',
        ],
        [
            'name' => 'column2',
            'label' => 'Column2',
        ],
        [
            'name' => 'column3',
            'label' => 'Column3',
        ],
    ];

    private $expectedThreeColumnsArray = [
        'column1' => [
            'name' => 'column1',
            'label' => 'Column1',
        ],
        'column2' => [
            'name' => 'column2',
            'label' => 'Column2',
        ],
        'column3' => [
            'name' => 'column3',
            'label' => 'Column3',
        ],
    ];

    public function testAddColumnByName()
    {
        $this->crudPanel->addColumn('column1');

        $this->assertEquals(1, count($this->crudPanel->columns));
        $this->assertContains($this->oneColumnArray, $this->crudPanel->columns);
    }

    public function testAddColumnsByName()
    {
        $this->crudPanel->addColumns(['column1', 'column2']);

        $this->assertEquals(2, count($this->crudPanel->columns));
        $this->assertEquals($this->expectedTwoColumnsArray, $this->crudPanel->columns);
    }

    public function testAddColumnAsArray()
    {
        $this->crudPanel->addColumn($this->oneColumnArray);

        $this->assertEquals(1, count($this->crudPanel->columns));
        $this->assertContains($this->oneColumnArray, $this->crudPanel->columns);
    }

    public function testAddColumnsAsArray()
    {
        $this->crudPanel->addColumns($this->twoColumnsArray);

        $this->assertEquals(2, count($this->crudPanel->columns));
        $this->assertEquals($this->expectedTwoColumnsArray, $this->crudPanel->columns);
    }

    public function testAddColumnNotArray()
    {
        $this->setExpectedException(\ErrorException::class);

        $this->crudPanel->addColumns('column1');
    }

    public function testMoveColumnBefore()
    {
        $this->crudPanel->addColumns($this->twoColumnsArray);

        $this->crudPanel->beforeColumn('column1');

        $keys = array_keys($this->crudPanel->columns);
        $this->assertEquals($this->expectedTwoColumnsArray['column2'], $this->crudPanel->columns[$keys[0]]);
        $this->assertEquals(['column2', 'column1'], $keys);
    }

    public function testMoveColumnBeforeUnknownColumnName()
    {
        $this->markTestIncomplete("Not correctly implemented");

        $this->crudPanel->addColumns($this->twoColumnsArray);
<commit_msg>Apply fixes from StyleCI (#904)<commit_after><?php

namespace Backpack\CRUD\Tests\Unit\CrudPanel;

class CrudPanelColumnsTest extends BaseCrudPanelTest
{
    private $oneColumnArray = [
        'name' => 'column1',
        'label' => 'Column1',
    ];

    private $otherOneColumnArray = [
        'name' => 'column4',
        'label' => 'Column4',
    ];

    private $twoColumnsArray = [
        [
            'name' => 'column1',
            'label' => 'Column1',
        ],
        [
            'name' => 'column2',
            'label' => 'Column2',
        ],
    ];

    private $expectedTwoColumnsArray = [
        'column1' => [
            'name' => 'column1',
            'label' => 'Column1',
        ],
        'column2' => [
            'name' => 'column2',
            'label' => 'Column2',
        ],
    ];

    private $threeColumnsArray = [
        [
            'name' => 'column1',
            'label' => 'Column1',
        ],
        [
            'name' => 'column2',
            'label' => 'Column2',
        ],
        [
            'name' => 'column3',
            'label' => 'Column3',
        ],
    ];

    private $expectedThreeColumnsArray = [
        'column1' => [
            'name' => 'column1',
            'label' => 'Column1',
        ],
        'column2' => [
            'name' => 'column2',
            'label' => 'Column2',
        ],
        'column3' => [
            'name' => 'column3',
            'label' => 'Column3',
        ],
    ];

    public function testAddColumnByName()
    {
        $this->crudPanel->addColumn('column1');

        $this->assertEquals(1, count($this->crudPanel->columns));
        $this->assertContains($this->oneColumnArray, $this->crudPanel->columns);
    }

    public function testAddColumnsByName()
    {
        $this->crudPanel->addColumns(['column1', 'column2']);

        $this->assertEquals(2, count($this->crudPanel->columns));
        $this->assertEquals($this->expectedTwoColumnsArray, $this->crudPanel->columns);
    }

    public function testAddColumnAsArray()
    {
        $this->crudPanel->addColumn($this->oneColumnArray);

        $this->assertEquals(1, count($this->crudPanel->columns));
        $this->assertContains($this->oneColumnArray, $this->crudPanel->columns);
    }

    public function testAddColumnsAsArray()
    {
        $this->crudPanel->addColumns($this->twoColumnsArray);

        $this->assertEquals(2, count($this->crudPanel->columns));
        $this->assertEquals($this->expectedTwoColumnsArray, $this->crudPanel->columns);
    }

    public function testAddColumnNotArray()
    {
        $this->setExpectedException(\ErrorException::class);

        $this->crudPanel->addColumns('column1');
    }

    public function testMoveColumnBefore()
    {
        $this->crudPanel->addColumns($this->twoColumnsArray);

        $this->crudPanel->beforeColumn('column1');

        $keys = array_keys($this->crudPanel->columns);
        $this->assertEquals($this->expectedTwoColumnsArray['column2'], $this->crudPanel->columns[$keys[0]]);
        $this->assertEquals(['column2', 'column1'], $keys);
    }

    public function testMoveColumnBeforeUnknownColumnName()
    {
        $this->markTestIncomplete('Not correctly implemented');

        $this->crudPanel->addColumns($this->twoColumnsArray);

{'fraction_non_alphanumeric': 0.16949924127465857, 'fraction_numerical': 0.013201820940819424, 'mean_word_length': 2.213554363725012, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 175, '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': '361853', 'n_tokens_mistral': 1948, 'n_tokens_neox': 1909, 'n_words': 262}