Sha256: 060a4434efda1986587cac483cbab3a2159816360ee91e55b7e7ee140e50a5ad

Contents?: true

Size: 1.97 KB

Versions: 275

Compression:

Stored size: 1.97 KB

Contents

<?php

require "luhn.php";

class LuhnValidatorTest extends PHPUnit\Framework\TestCase
{
    public function testSingleDigitInvalid()
    {
        $this->assertFalse(isValid("1"));
    }

    public function testSingleZeroInvalid()
    {
        $this->markTestSkipped();

        $this->assertFalse(isValid("0"));
    }

    public function testSimpleValidNumber()
    {
        $this->markTestSkipped();

        $this->assertTrue(isValid("59"));
    }

    public function testSpaceHandling()
    {
        $this->markTestSkipped();

        $this->assertTrue(isValid(" 5 9 "));
    }

    public function testValidCanadianSocialInsuranceNumber()
    {
        $this->markTestSkipped();

        $this->assertTrue(isValid("046 454 286"));
    }

    public function testInvalidCanadianSocialInsuranceNumber()
    {
        $this->markTestSkipped();

        $this->assertFalse(isValid("046 454 287"));
    }

    public function testInvalidCreditCard()
    {
        $this->markTestSkipped();

        $this->assertFalse(isValid("8273 1232 7352 0569"));
    }

    public function testNonDigitCharacterInValidStringInvalidatesTheString()
    {
        $this->markTestSkipped();

        $this->assertFalse(isValid("046a 454 286"));
    }

    public function testThatStringContainingSymbolsIsInvalid()
    {
        $this->markTestSkipped();

        $this->assertFalse(isValid("055£ 444$ 285"));
    }

    public function testThatStringContainingPunctuationIsInvalid()
    {
        $this->markTestSkipped();

        $this->assertFalse(isValid("055-444-285"));
    }

    public function testSpaceAndSingleZeroIsInvalid()
    {
        $this->markTestSkipped();

        $this->assertFalse(isValid(" 0"));
    }

    public function testMultipleZerosIsValid()
    {
        $this->markTestSkipped();

        $this->assertTrue(isValid(" 00000"));
    }

    public function testThatDoublingNineIsHandledCorrectly()
    {
        $this->markTestSkipped();

        $this->assertTrue(isValid("091"));
    }
}

Version data entries

275 entries across 275 versions & 1 rubygems

Version Path
trackler-2.2.1.180 tracks/php/exercises/luhn/luhn_test.php
trackler-2.2.1.179 tracks/php/exercises/luhn/luhn_test.php
trackler-2.2.1.178 tracks/php/exercises/luhn/luhn_test.php
trackler-2.2.1.177 tracks/php/exercises/luhn/luhn_test.php
trackler-2.2.1.176 tracks/php/exercises/luhn/luhn_test.php
trackler-2.2.1.175 tracks/php/exercises/luhn/luhn_test.php
trackler-2.2.1.174 tracks/php/exercises/luhn/luhn_test.php
trackler-2.2.1.173 tracks/php/exercises/luhn/luhn_test.php
trackler-2.2.1.172 tracks/php/exercises/luhn/luhn_test.php
trackler-2.2.1.171 tracks/php/exercises/luhn/luhn_test.php
trackler-2.2.1.170 tracks/php/exercises/luhn/luhn_test.php
trackler-2.2.1.169 tracks/php/exercises/luhn/luhn_test.php
trackler-2.2.1.167 tracks/php/exercises/luhn/luhn_test.php
trackler-2.2.1.166 tracks/php/exercises/luhn/luhn_test.php
trackler-2.2.1.165 tracks/php/exercises/luhn/luhn_test.php
trackler-2.2.1.164 tracks/php/exercises/luhn/luhn_test.php
trackler-2.2.1.163 tracks/php/exercises/luhn/luhn_test.php
trackler-2.2.1.162 tracks/php/exercises/luhn/luhn_test.php
trackler-2.2.1.161 tracks/php/exercises/luhn/luhn_test.php
trackler-2.2.1.160 tracks/php/exercises/luhn/luhn_test.php