<commit_before><?php

namespace Bdt\Avetmiss\Tests;

use Bdt\Avetmiss\Fieldset;
use Bdt\Avetmiss\File;
use Bdt\Avetmiss\Fields\Field;
use Bdt\Avetmiss\Row;

class FileTest extends TestCase
{


    /**
     * @expectedException Exception
     * @expectedExceptionMessage Cant add invalid row
     */
    public function testAddInvalidRow()
    {
        $fieldset = new Fieldset([Field::make('any')]);
        $file = new File($fieldset);

        $row = $this->getMockBuilder(Row::class)->disableOriginalConstructor()->getMock();
        $row->method('isValid')->withAnyParameters()->willReturn(false);

        $file->addRow($row);
    }

    /**
     * @expectedException Exception
     * @expectedExceptionMessage Cant add row with different fieldset
     */
    public function testAddMismatchRow()
    {
        $file = new File(new Fieldset([Field::make('any')->name('foo')]));
        $row = new Row(new Fieldset([Field::make('any')->name('bar')]));
        $file->addRow($row);
    }
<commit_msg>Fix 5.4 compat in tests<commit_after><?php

namespace Bdt\Avetmiss\Tests;

use Bdt\Avetmiss\Fieldset;
use Bdt\Avetmiss\File;
use Bdt\Avetmiss\Fields\Field;
use Bdt\Avetmiss\Row;

class FileTest extends TestCase
{


    /**
     * @expectedException Exception
     * @expectedExceptionMessage Cant add invalid row
     */
    public function testAddInvalidRow()
    {
        $fieldset = new Fieldset([Field::make('any')]);
        $file = new File($fieldset);

        $row = $this->getMockBuilder('\Bdt\Avetmiss\Row')->disableOriginalConstructor()->getMock();
        $row->method('isValid')->withAnyParameters()->willReturn(false);

        $file->addRow($row);
    }

    /**
     * @expectedException Exception
     * @expectedExceptionMessage Cant add row with different fieldset
     */
    public function testAddMismatchRow()
    {
        $file = new File(new Fieldset([Field::make('any')->name('foo')]));
        $row = new Row(new Fieldset([Field::make('any')->name('bar')]));
        $file->addRow($row);
    }

{'fraction_non_alphanumeric': 0.15688209176122347, 'fraction_numerical': 0.000986679822397632, 'mean_word_length': 3.2694736842105265, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 23, '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': '3174029', 'n_tokens_mistral': 619, 'n_tokens_neox': 612, 'n_words': 116}