<commit_before><?php
/**
 * This file is part of PHP Mess Detector.
 *
 * Copyright (c) <NAME> <<EMAIL>>.
 * All rights reserved.
 *
 * Licensed under BSD License
 * For full copyright and license information, please see the LICENSE file.
 * Redistributions of files must retain the above copyright notice.
 *
 * @author <NAME> <<EMAIL>>
 * @copyright <NAME>. All rights reserved.
 * @license https://opensource.org/licenses/bsd-license.php BSD License
 * @link http://phpmd.org/
 */

namespace PHPMD\Support;

use PHPMD\AbstractTest;

/**
 * Test cases for the Strings utility class.
 *
 * @coversDefaultClass  \PHPMD\Support\Strings
 */
class StringsTest extends AbstractTest
{
    /**
     * @return void
     */
    public function testLengthEmptyString()
    {
        static::assertSame(0, Strings::lengthWithoutSuffixes('', array()));
    }

    /**
     * @return void
     */
    public function testLengthEmptyStringWithConfiguredSubtractSuffix()
    {
        static::assertSame(0, Strings::lengthWithoutSuffixes('', array('Foo', 'Bar')));
    }

    /**
     * @return void
     */
    public function testLengthStringWithoutSubtractSuffixMatch()
    {
        static::assertSame(8, Strings::lengthWithoutSuffixes('UnitTest', array('Foo', 'Bar')));
    }

    /**
     * @return void
     */
    public function testLengthStringWithSubtractSuffixMatch()
    {
        static::assertSame(4, Strings::lengthWithoutSuffixes('UnitBar', array('Foo', 'Bar')));
    }

    /**
     * @return void
     */
    public function testLengthStringWithDoubleSuffixMatchSubtractOnce()
    {
        static::assertSame(7, Strings::lengthWithoutSuffixes('UnitFooBar', array('Foo', 'Bar')));
    }

    /**
     * @return void
     */
    public function testLengthStringWithPrefixMatchShouldNotSubtract()
    {
        static::assertSame(11, Strings::lengthWithoutSuffixes('FooUnitTest', array('Foo', 'Bar')));
    }

    /**
     * @expectedException \InvalidArgumentException
     *
     * @return void
     */
    public function testSplitEmptySeparatorThrowsException()
    {
        Strings::splitToList('UnitTest', '');
    }

    /**
     * @return void
     */
    public function testSplitEmptyString()
    {
        static::assertSame(array(), Strings::splitToList('', ','));
    }

    /**
     * @return void
     */
    public function testSplitStringWithoutMatchingSeparator()
    {
        static::assertSame(array('UnitTest'), Strings::splitToList('UnitTest', ','));
    }

    /**
     * @return void
     */
    public function testSplitStringWithMatchingSeparator()
    {
        static::assertSame(array('Unit', 'Test'), Strings::splitToList('Unit,Test', ','));
    }

    /**
     * @return void
     */
    public function testSplitStringTrimsLeadingAndTrailingWhitespace()
    {
        static::assertSame(array('Unit', 'Test'), Strings::splitToList('Unit , Test', ','));
    }

    /**
     * @return void
     */
    public function testSplitStringRemoveEmptyStringValues()
    {
        static::assertSame(array('Foo'), Strings::splitToList('Foo,,,', ','));
    }

    /**
     * @return void
     */
    public function testSplitStringShouldNotRemoveAZeroValue()
    {
        static::assertSame(array('0', '1', '2'), Strings::splitToList('0,1,2', ','));
    }
}<commit_msg>Update test case names to changed method names<commit_after><?php
/**
 * This file is part of PHP Mess Detector.
 *
 * Copyright (c) <NAME> <<EMAIL>>.
 * All rights reserved.
 *
 * Licensed under BSD License
 * For full copyright and license information, please see the LICENSE file.
 * Redistributions of files must retain the above copyright notice.
 *
 * @author <NAME> <<EMAIL>>
 * @copyright <NAME>. All rights reserved.
 * @license https://opensource.org/licenses/bsd-license.php BSD License
 * @link http://phpmd.org/
 */

namespace PHPMD\Support;

use PHPMD\AbstractTest;

/**
 * Test cases for the Strings utility class.
 *
 * @coversDefaultClass  \PHPMD\Support\Strings
 */
class StringsTest extends AbstractTest
{
    /**
     * @return void
     */
    public function testLengthWithoutSuffixesEmptyString()
    {
        static::assertSame(0, Strings::lengthWithoutSuffixes('', array()));
    }

    /**
     * @return void
     */
    public function testLengthWithoutSuffixesEmptyStringWithConfiguredSubtractSuffix()
    {
        static::assertSame(0, Strings::lengthWithoutSuffixes('', array('Foo', 'Bar')));
    }

    /**
     * @return void
     */
    public function testLengthWithoutSuffixesStringWithoutSubtractSuffixMatch()
    {
        static::assertSame(8, Strings::lengthWithoutSuffixes('UnitTest', array('Foo', 'Bar')));
    }

    /**
     * @return void
     */
    public function testLengthWithoutSuffixesStringWithSubtractSuffixMatch()
    {
        static::assertSame(4, Strings::lengthWithoutSuffixes('UnitBar', array('Foo', 'Bar')));
    }

    /**
     * @return void
     */
    public function testLengthWithoutSuffixesStringWithDoubleSuffixMatchSubtractOnce()
    {
        static::assertSame(7, Strings::lengthWithoutSuffixes('UnitFooBar', array('Foo', 'Bar')));
    }

    /**
     * @return void
     */
    public function testLengthWithoutSuffixesStringWithPrefixMatchShouldNotSubtract()
    {
        static::assertSame(11, Strings::lengthWithoutSuffixes('FooUnitTest', array('Foo', 'Bar')));
    }

    /**
     * @expectedException \InvalidArgumentException
     *
     * @return void
     */
    public function testSplitToListEmptySeparatorThrowsException()
    {
        Strings::splitToList('UnitTest', '');
    }

    /**
     * @return void
     */
    public function testSplitToListEmptyString()
    {
        static::assertSame(array(), Strings::splitToList('', ','));
    }

    /**
     * @return void
     */
    public function testSplitToListStringWithoutMatchingSeparator()
    {
        static::assertSame(array('UnitTest'), Strings::splitToList('UnitTest', ','));
    }

    /**
     * @return void
     */
    public function testSplitToListStringWithMatchingSeparator()
    {
        static::assertSame(array('Unit', 'Test'), Strings::splitToList('Unit,Test', ','));
    }

    /**
     * @return void
     */
    public function testSplitToListStringTrimsLeadingAndTrailingWhitespace()
    {
        static::assertSame(array('Unit', 'Test'), Strings::splitToList('Unit , Test', ','));
    }

    /**
     * @return void
     */
    public function testSplitToListStringRemoveEmptyStringValues()
    {
        static::assertSame(array('Foo'), Strings::splitToList('Foo,,,', ','));
    }

    /**
     * @return void
     */
    public function testSplitToListStringShouldNotRemoveAZeroValue()
    {
        static::assertSame(array('0', '1', '2'), Strings::splitToList('0,1,2', ','));
    }
}
{'fraction_non_alphanumeric': 0.14562675743673228, 'fraction_numerical': 0.0038478614769868287, 'mean_word_length': 3.120731707317073, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 17, 'https://': 2, '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': '2968025', 'n_tokens_mistral': 2010, 'n_tokens_neox': 1948, 'n_words': 365}