2015-12-09 12:36:30 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Created by PhpStorm.
|
|
|
|
* User: seekdasky
|
|
|
|
* Date: 09/12/15
|
|
|
|
* Time: 12:44
|
|
|
|
*/
|
|
|
|
class StaticRepoTest extends PHPUnit_Framework_TestCase
|
|
|
|
{
|
|
|
|
public function testGetConnexion(){
|
|
|
|
$this->assertTrue(StaticRepo::getConnexion() instanceof PDO);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testTestConnexion(){
|
|
|
|
$this->assertTrue(StaticRepo::testConnexion());
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testDelNumericOneDimension(){
|
|
|
|
$array = [0=>'kjbk','kughk'=>'kjbk',1=>'aze','azert'=>'aza'];
|
|
|
|
$this->assertEquals(StaticRepo::delNumeric($array,true),['kughk'=>'kjbk','azert'=>'aza']);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testDelNumericTwoDimension(){
|
|
|
|
$array = [0=>[0=>'kjbk','kughk'=>'kjbk',1=>'aze','azert'=>'aze'],1=>[0=>'kjbk','kughk'=>'kjbk',1=>'aze','azert'=>'aza']];
|
|
|
|
$this->assertEquals(StaticRepo::delNumeric($array),[0=>['kughk'=>'kjbk','azert'=>'aze'],1=>['kughk'=>'kjbk','azert'=>'aza']]);
|
|
|
|
}
|
|
|
|
|
2015-12-10 08:04:19 +00:00
|
|
|
public function testCheckParam(){
|
|
|
|
$this->assertTrue(StaticRepo::checkParam("Bonjour",'String20'));
|
|
|
|
$this->assertFalse(StaticRepo::checkParam("Bonjour",'String5'));
|
|
|
|
|
|
|
|
$this->assertTrue(StaticRepo::checkParam("M",'Civilite'));
|
|
|
|
$this->assertTrue(StaticRepo::checkParam("F",'Civilite'));
|
|
|
|
$this->assertFalse(StaticRepo::checkParam("P",'Civilite'));
|
|
|
|
|
|
|
|
$this->assertTrue(StaticRepo::checkParam(100,'Integer'));
|
|
|
|
$this->assertTrue(StaticRepo::checkParam(0,'Integer'));
|
|
|
|
$this->assertFalse(StaticRepo::checkParam(4294967296,'Integer'));
|
|
|
|
|
|
|
|
$this->assertTrue(StaticRepo::checkParam(100,'TinyInteger'));
|
|
|
|
$this->assertTrue(StaticRepo::checkParam(0,'TinyInteger'));
|
|
|
|
$this->assertFalse(StaticRepo::checkParam(256,'TinyInteger'));
|
|
|
|
|
|
|
|
$this->assertTrue(StaticRepo::checkParam(100,'SmallInteger'));
|
|
|
|
$this->assertTrue(StaticRepo::checkParam(0,'SmallInteger'));
|
|
|
|
$this->assertFalse(StaticRepo::checkParam(65536,'SmallInteger'));
|
|
|
|
|
|
|
|
$this->assertTrue(StaticRepo::checkParam(100,'BigInteger'));
|
|
|
|
$this->assertTrue(StaticRepo::checkParam(0,'BigInteger'));
|
|
|
|
$this->assertFalse(StaticRepo::checkParam(18446744073700000000,'BigInteger'));
|
|
|
|
|
|
|
|
$this->assertFalse(StaticRepo::checkParam('lololo','lolololo'));
|
|
|
|
}
|
2015-12-09 12:36:30 +00:00
|
|
|
}
|