NxTIC/test/phpunit/tests/Database_readableNumber.php

55 lines
2.2 KiB
PHP
Raw Normal View History

2016-04-20 09:59:21 +00:00
<?php namespace phpunit;
use \database\core\Database;
2016-04-20 09:59:21 +00:00
class Database_readableNumber extends \PHPUnit_Framework_TestCase{
private $formatted = '01 02 03 04 05';
/* [1] Gestion du formattage+affichage des numéros
=========================================================*/
public function testA(){
$this->assertEquals( Database::readableNumber('0102030405'), $this->formatted );
$this->assertEquals( Database::readableNumber('01 02 03 04 05'), $this->formatted );
}
public function testB(){
$this->assertEquals( Database::readableNumber('+33102030405'), $this->formatted );
$this->assertEquals( Database::readableNumber('+331 02 03 04 05'), $this->formatted );
}
public function testC(){
$this->assertEquals( Database::readableNumber('33102030405'), $this->formatted );
$this->assertEquals( Database::readableNumber('331 02 03 04 05'), $this->formatted );
}
public function testCbis(){
$this->assertEquals( Database::readableNumber('033102030405'), $this->formatted );
$this->assertEquals( Database::readableNumber('0331 02 03 04 05'), $this->formatted );
}
public function testBter(){
$this->assertEquals( Database::readableNumber('0033102030405'), $this->formatted );
$this->assertEquals( Database::readableNumber('00331 02 03 04 05'), $this->formatted );
}
public function testFirstSpace(){
$this->assertEquals( Database::readableNumber('0 102030405'), $this->formatted );
$this->assertEquals( Database::readableNumber('+33 102030405'), $this->formatted );
$this->assertEquals( Database::readableNumber('33 102030405'), $this->formatted );
$this->assertEquals( Database::readableNumber('033 102030405'), $this->formatted );
$this->assertEquals( Database::readableNumber('0033 102030405'), $this->formatted );
}
public function testAllSpaces(){
$this->assertEquals( Database::readableNumber('0 1 02 03 04 05'), $this->formatted );
$this->assertEquals( Database::readableNumber('+33 1 02 03 04 05'), $this->formatted );
$this->assertEquals( Database::readableNumber('33 1 02 03 04 05'), $this->formatted );
$this->assertEquals( Database::readableNumber('033 1 02 03 04 05'), $this->formatted );
$this->assertEquals( Database::readableNumber('0033 1 02 03 04 05'), $this->formatted );
}
}
?>