<commit_before><?php

namespace CultuurNet\UDB3\Label\ValueObjects;

class LabelNameTest extends \PHPUnit_Framework_TestCase
{
    /**
     * @test
     */
    public function it_refuses_value_that_are_not_strings()
    {
        $this->setExpectedException(\InvalidArgumentException::class);

        new LabelName(null);
    }

    /**
     * @test
     */
    public function it_refuses_value_containing_a_semicolon()
    {
        $this->setExpectedException(\InvalidArgumentException::class);

        new LabelName(';');
    }

    /**
     * @test
     */
    public function it_refuses_value_with_length_less_than_three()
    {
        $this->setExpectedException(\InvalidArgumentException::class);

        new LabelName('k');
    }

    /**
     * @test
     */
    public function it_refuses_value_with_length_longer_than_255()
    {
        $this->setExpectedException(\InvalidArgumentException::class);

        new LabelName(
            'turnip greens yarrow ricebean rutabaga endive cauliflower sea lettuce kohlrabi amaranth water spinach avocado daikon napa cabbage asparagus winter purslane kale celery potato scallion desert raisin horseradish spinach carrot soko Lotus root water spinach fennel'
        );
    }

    /**
     * @test
     */
    public function it_accepts_a_regular_string_length_for_value()
    {
        $label = new LabelName('turnip');

        $this->assertEquals($label->__toString(), 'turnip');
    }
}<commit_msg>III-1137 Also test validness of LabelName with something else then null.<commit_after><?php

namespace CultuurNet\UDB3\Label\ValueObjects;

use ValueObjects\Exception\InvalidNativeArgumentException;

class LabelNameTest extends \PHPUnit_Framework_TestCase
{
    /**
     * @dataProvider labelNameValues
     * @test
     */
    public function it_refuses_value_that_are_not_strings($value)
    {
        $this->setExpectedException(InvalidNativeArgumentException::class);

        new LabelName($value);
    }

    /**
     * @test
     */
    public function it_refuses_value_containing_a_semicolon()
    {
        $this->setExpectedException(\InvalidArgumentException::class);

        new LabelName(';');
    }

    /**
     * @test
     */
    public function it_refuses_value_with_length_less_than_three()
    {
        $this->setExpectedException(\InvalidArgumentException::class);

        new LabelName('k');
    }

    /**
     * @test
     */
    public function it_refuses_value_with_length_longer_than_255()
    {
        $this->setExpectedException(\InvalidArgumentException::class);

        new LabelName(
            'turnip greens yarrow ricebean rutabaga endive cauliflower sea lettuce kohlrabi amaranth water spinach avocado daikon napa cabbage asparagus winter purslane kale celery potato scallion desert raisin horseradish spinach carrot soko Lotus root water spinach fennel'
        );
    }

    /**
     * @test
     */
    public function it_accepts_a_regular_string_length_for_value()
    {
        $label = new LabelName('turnip');

        $this->assertEquals($label->toNative(), 'turnip');
    }

    /**
     * @return array
     */
    public function labelNameValues()
    {
        return [
            [null],
            [1],
        ];
    }
}
{'fraction_non_alphanumeric': 0.09697344039530574, 'fraction_numerical': 0.004014823965410748, 'mean_word_length': 2.7971864009378664, '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': '3618881', 'n_tokens_mistral': 981, 'n_tokens_neox': 915, 'n_words': 180}