<commit_before><?php

namespace Intervention\Validation\Test;

use Intervention\Validation\Validator;
use PHPUnit\Framework\TestCase;

class ValidationTest extends TestCase
{
    public function testValidateIsin()
    {
        $isin = 'US0378331005';
        $no_isin = 'ZA9382189201';
        $this->assertTrue(Validator::isIsin($isin));
        $this->assertFalse(Validator::isIsin($no_isin));

        $isin = 'DE0005810055';
        $no_isin = 'DE0005810058';
        $this->assertTrue(Validator::isIsin($isin));
        $this->assertFalse(Validator::isIsin($no_isin));
    }

    public function testValidateIban()
    {
        $iban = 'DE12500105170648489890';
        $no_iban = 'DE21340155170648089890';
        $this->assertTrue(Validator::isIban($iban));
        $this->assertFalse(Validator::isIban($no_iban));

        $iban = 'GB82 WEST 1234 5698 7654 32';
        $no_iban = 'GR82 WEST 1234 5698 7654 32';
        $this->assertTrue(Validator::isIban($iban));
        $this->assertFalse(Validator::isIban($no_iban));

        $no_iban = '5070081';
        $this->assertFalse(Validator::isIban($no_iban));
    }

    public function testValidateBic()
    {
        $bic = 'PBNKDEFF';
        $no_bic = 'ABNFDBF';
        $this->assertTrue(Validator::isBic($bic));
        $this->assertFalse(Validator::isBic($no_bic));
    }

    public function testValidateCreditcard()
    {
        $cc = '4444111122223333';
        $no_cc = '9182819264532375';
        $this->assertTrue(Validator::isCreditcard($cc));
        $this->assertFalse(Validator::isCreditcard($no_cc));
    }

    public function testValidateCreditcardWithValueLenthIsInvalid()
    {
        $invalid = '123';
        $this->assertFalse(Validator::isCreditcard($invalid));
    }

    public function testValidateHexcolor()
    {
        // hex
        $this->assertTrue(Validator::isHexcolor('#cccccc'));
        $this->assertTrue(Validator::isHexcolor('b33517'));
        $this->assertTrue(Validator::isHexcolor('#ccc'));
        $this->assertTrue(Validator::isHexcolor('abc'));

        // no hex
        $this->assertFalse(Validator::isHexcolor('x25s11'));
        $this->assertFalse(Validator::isHexcolor('ffff'));
        $this->assertFalse(Validator::isHexcolor('#ffff'));
        $this->assertFalse(Validator::isHexcolor('ff'));
        $this->assertFalse(Validator::isHexcolor('#'));
        $this->assertFalse(Validator::isHexcolor(null));
    }

    public function testValidateIsbn()
    {
        $isbn1 = '3498016709';
        $isbn2 = '978-3499255496';
        $isbn3 = '85-359-0277-5';
        $no_isbn = '123459181';
        $this->assertTrue(Validator::isIsbn($isbn1));
        $this->assertTrue(Validator::isIsbn($isbn2));
        $this->assertTrue(Validator::isIsbn($isbn3));
        $this->assertFalse(Validator::isIsbn($no_isbn));
    }

    public function testValidateIsbnWithValueIsNotNumeric()
    {
        $invalid = 'invalidxxx';
        $this->assertFalse(Validator::isIsbn($invalid));
    }

    public function testValidateIsodate()
    {
        $iso_dates = array(
            '1977-06-17',
            '2000-06-17 06:15:12',
            '1977',
            '1000',
            1000,
            '0000',
            '1977-06-17 00:00',
            '1977-06-17 14:12:59',
            '2009-05-19 14:39:22+0600'
        );

        foreach ($iso_dates as $date) {
            $this->assertTrue(Validator::isIsodate($date));
        }
<commit_msg>Added timestamp formats in isIsoDate() tests<commit_after><?php

namespace Intervention\Validation\Test;

use Intervention\Validation\Validator;
use PHPUnit\Framework\TestCase;

class ValidationTest extends TestCase
{
    public function testValidateIsin()
    {
        $isin = 'US0378331005';
        $no_isin = 'ZA9382189201';
        $this->assertTrue(Validator::isIsin($isin));
        $this->assertFalse(Validator::isIsin($no_isin));

        $isin = 'DE0005810055';
        $no_isin = 'DE0005810058';
        $this->assertTrue(Validator::isIsin($isin));
        $this->assertFalse(Validator::isIsin($no_isin));
    }

    public function testValidateIban()
    {
        $iban = 'DE12500105170648489890';
        $no_iban = 'DE21340155170648089890';
        $this->assertTrue(Validator::isIban($iban));
        $this->assertFalse(Validator::isIban($no_iban));

        $iban = 'GB82 WEST 1234 5698 7654 32';
        $no_iban = 'GR82 WEST 1234 5698 7654 32';
        $this->assertTrue(Validator::isIban($iban));
        $this->assertFalse(Validator::isIban($no_iban));

        $no_iban = '5070081';
        $this->assertFalse(Validator::isIban($no_iban));
    }

    public function testValidateBic()
    {
        $bic = 'PBNKDEFF';
        $no_bic = 'ABNFDBF';
        $this->assertTrue(Validator::isBic($bic));
        $this->assertFalse(Validator::isBic($no_bic));
    }

    public function testValidateCreditcard()
    {
        $cc = '4444111122223333';
        $no_cc = '9182819264532375';
        $this->assertTrue(Validator::isCreditcard($cc));
        $this->assertFalse(Validator::isCreditcard($no_cc));
    }

    public function testValidateCreditcardWithValueLenthIsInvalid()
    {
        $invalid = '123';
        $this->assertFalse(Validator::isCreditcard($invalid));
    }

    public function testValidateHexcolor()
    {
        // hex
        $this->assertTrue(Validator::isHexcolor('#cccccc'));
        $this->assertTrue(Validator::isHexcolor('b33517'));
        $this->assertTrue(Validator::isHexcolor('#ccc'));
        $this->assertTrue(Validator::isHexcolor('abc'));

        // no hex
        $this->assertFalse(Validator::isHexcolor('x25s11'));
        $this->assertFalse(Validator::isHexcolor('ffff'));
        $this->assertFalse(Validator::isHexcolor('#ffff'));
        $this->assertFalse(Validator::isHexcolor('ff'));
        $this->assertFalse(Validator::isHexcolor('#'));
        $this->assertFalse(Validator::isHexcolor(null));
    }

    public function testValidateIsbn()
    {
        $isbn1 = '3498016709';
        $isbn2 = '978-3499255496';
        $isbn3 = '85-359-0277-5';
        $no_isbn = '123459181';
        $this->assertTrue(Validator::isIsbn($isbn1));
        $this->assertTrue(Validator::isIsbn($isbn2));
        $this->assertTrue(Validator::isIsbn($isbn3));
        $this->assertFalse(Validator::isIsbn($no_isbn));
    }

    public function testValidateIsbnWithValueIsNotNumeric()
    {
        $invalid = 'invalidxxx';
        $this->assertFalse(Validator::isIsbn($invalid));
    }

    public function testValidateIsodate()
    {
        $iso_dates = array(
            '1977-06-17',
            '2000-06-17 06:15:12',
            '1977',
            '1000',
            2020,
            '0000',
            '1977-06-17 00:00',
            '1977-06-17 14:12:59',
            '2009-05-19 14:39:22+0600',
            '2015-09-21T19:39:41+03:00',
            '2015-09-21T19:39',
        );

        foreach ($iso_dates as $date) {
            $this->assertTrue(Validator::isIsodate($date));
        }

{'fraction_non_alphanumeric': 0.1588478539854556, 'fraction_numerical': 0.08783687437615856, 'mean_word_length': 2.7913513513513513, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 63, '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': '4592683', 'n_tokens_mistral': 2657, 'n_tokens_neox': 2241, 'n_words': 283}