Skip to content

Commit

Permalink
✅ BASE update testes
Browse files Browse the repository at this point in the history
  • Loading branch information
bjverde committed Sep 15, 2021
1 parent 116adb3 commit 803f1ce
Show file tree
Hide file tree
Showing 6 changed files with 143 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
class FormDinHelper
{

const FORMDIN_VERSION = '5.0.0-alpha25';
const FORMDIN_VERSION = '5.0.0-alpha26';
const GRID_SIMPLE = 'GRID_SIMPLE';
const GRID_SCREEN_PAGINATION = 'GRID_SCREEN_PAGINATION';
const GRID_SQL_PAGINATION = 'GRID_SQL_PAGINATION';
Expand Down
52 changes: 52 additions & 0 deletions FormDin5/tests/lib/widget/FormDin5/helpers/DateTimeHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -253,4 +253,56 @@ public function testIsWorkingDayFalse() {
$retorno = DateTimeHelper::isWorkingDay($entrada);
$this->assertEquals($esperado, $retorno);
}

//------------------------------------------------------------
//------------------------------------------------------------
//------------------------------------------------------------
public function testMaskDateFormDin4ToAdianit_DMY() {
$esperado = 'dd-mm-yyyy';
$entrada = 'DMY';
$retorno = DateTimeHelper::maskDateFormDin4ToAdianit($entrada);
$this->assertEquals($esperado, $retorno);
}
public function testMaskDateFormDin4ToAdianit_YMD() {
$esperado = 'yyyy-mm-dd';
$entrada = 'YMD';
$retorno = DateTimeHelper::maskDateFormDin4ToAdianit($entrada);
$this->assertEquals($esperado, $retorno);
}
public function testMaskDateFormDin4ToAdianit_MDY() {
$esperado = 'mm-dd-yyyy';
$entrada = 'MDY';
$retorno = DateTimeHelper::maskDateFormDin4ToAdianit($entrada);
$this->assertEquals($esperado, $retorno);
}
public function testMaskDateFormDin4ToAdianit_MD() {
$esperado = 'mm-dd';
$entrada = 'MD';
$retorno = DateTimeHelper::maskDateFormDin4ToAdianit($entrada);
$this->assertEquals($esperado, $retorno);
}
public function testMaskDateFormDin4ToAdianit_DM() {
$esperado = 'dd-mm';
$entrada = 'DM';
$retorno = DateTimeHelper::maskDateFormDin4ToAdianit($entrada);
$this->assertEquals($esperado, $retorno);
}
public function testMaskDateFormDin4ToAdianit_MY() {
$esperado = 'mm-yyyy';
$entrada = 'MY';
$retorno = DateTimeHelper::maskDateFormDin4ToAdianit($entrada);
$this->assertEquals($esperado, $retorno);
}
public function testMaskDateFormDin4ToAdianit_YM() {
$esperado = 'yyyy-mm';
$entrada = 'YM';
$retorno = DateTimeHelper::maskDateFormDin4ToAdianit($entrada);
$this->assertEquals($esperado, $retorno);
}
public function testMaskDateFormDin4ToAdianit_HM() {
$esperado = 'hh:ii';
$entrada = 'HM';
$retorno = DateTimeHelper::maskDateFormDin4ToAdianit($entrada);
$this->assertEquals($esperado, $retorno);
}
}
64 changes: 63 additions & 1 deletion FormDin5/tests/lib/widget/FormDin5/helpers/FormDinHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class FormDinHelperTest extends TestCase
{

public function testVersion() {
$expected = '5.0.0-alpha22';
$expected = '5.0.0-alpha26';
$result = FormDinHelper::version();
$this->assertEquals( $expected , $result);
}
Expand Down Expand Up @@ -211,5 +211,67 @@ public function testIssetOrNotZero_stringZeroNoTest() {
$result = FormDinHelper::issetOrNotZero($variable,false);
$this->assertEquals( $expected , $result);
}
//-----------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------

public function testValidateSizeWidthAndHeight_okNull()
{
$this->expectNotToPerformAssertions();
FormDinHelper::validateSizeWidthAndHeight(null);
}

public function testValidateSizeWidthAndHeight_okPercent()
{
$this->expectNotToPerformAssertions();
FormDinHelper::validateSizeWidthAndHeight('100%');
}

public function testValidateSizeWidthAndHeight_okEm()
{
$this->expectNotToPerformAssertions();
FormDinHelper::validateSizeWidthAndHeight('100em');
}

public function testValidateSizeWidthAndHeight_okRem()
{
$this->expectNotToPerformAssertions();
FormDinHelper::validateSizeWidthAndHeight('100rem');
}

public function testValidateSizeWidthAndHeight_okVh()
{
$this->expectNotToPerformAssertions();
FormDinHelper::validateSizeWidthAndHeight('100vh');
}

public function testValidateSizeWidthAndHeight_okVw()
{
$this->expectNotToPerformAssertions();
FormDinHelper::validateSizeWidthAndHeight('100vw');
}

public function testValidateSizeWidthAndHeight_failInt()
{
$this->expectException(InvalidArgumentException::class);
FormDinHelper::validateSizeWidthAndHeight(100);
}

public function testValidateSizeWidthAndHeight_failString()
{
$this->expectException(InvalidArgumentException::class);
FormDinHelper::validateSizeWidthAndHeight('100');
}

public function testValidateSizeWidthAndHeight_failPx()
{
$this->expectException(InvalidArgumentException::class);
FormDinHelper::validateSizeWidthAndHeight('100px');
}
public function testValidateSizeWidthAndHeight_okPx()
{
$this->expectNotToPerformAssertions();
FormDinHelper::validateSizeWidthAndHeight('100px',true);
}

}
24 changes: 24 additions & 0 deletions FormDin5/tests/lib/widget/FormDin5/helpers/StringHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,30 @@ public function testLimpaCnpjCpf() {
$this->assertEquals( $expected , $result );
}

public function testFormatPhoneNumber_celularComDdd() {
$expected = '(61) 99982-2045';
$result = StringHelper::formatPhoneNumber('61999822045') ;
$this->assertEquals( $expected , $result );
}

public function testFormatPhoneNumber_fixoComDdd() {
$expected = '(61) 1234-5678';
$result = StringHelper::formatPhoneNumber('611234-5678') ;
$this->assertEquals( $expected , $result );
}

public function testFormatPhoneNumber_celularSemDdd() {
$expected = '99982-2045';
$result = StringHelper::formatPhoneNumber('999822045') ;
$this->assertEquals( $expected , $result );
}

public function testFormatPhoneNumber_fixoSemDdd() {
$expected = '1234-5678';
$result = StringHelper::formatPhoneNumber('12345678') ;
$this->assertEquals( $expected , $result );
}

public function testTirarAcentos() {
$expected = 'Voce deve ter recebido uma copia da GNU LGPL versao 3';
$result = StringHelper::tirarAcentos(self::STRING_ORIGIN) ;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,23 +76,23 @@ public function test_instanceOff()
public function testSetAdiantiObj_failNullObjForm()
{
$this->expectException(InvalidArgumentException::class);
$classTest = new TFormDinButton(null,null);
$classTest = new TFormDinButton(null,null,null,null);
}

public function testSetAdiantiObj_failNullNameButton()
{
$this->expectException(InvalidArgumentException::class);

$classForm = new mockFormDinComAdianti();
$classTest = new TFormDinButton($classForm,null);
$classTest = new TFormDinButton($classForm,null,null,null);
}

public function testSetAdiantiObj_failNullStringName()
{
$this->expectException(InvalidArgumentException::class);

$classForm = new mockFormDinComAdianti();
$classTest = new TFormDinButton($classForm,'Salvar');
$classTest = new TFormDinButton($classForm,'Salvar',null,null);
}

public function testSetAdiantiObj_failArrayName()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,36 +73,6 @@ public function test_instanceOff()
$this->assertInstanceOf(TText::class, $adiantiObj);
}

public function testTestSize_fail()
{
$this->expectNotToPerformAssertions();
$this->classTest->testSize(null);
}

public function testTestSize_ok_String100Perent()
{
$result = $this->classTest->testSize('100%');
$this->assertEquals($result,'100%');
}

public function testTestSize_ok_String100()
{
$result = $this->classTest->testSize('100');
$this->assertEquals($result,'100');
}

public function testTestSize_ok_int100()
{
$result = $this->classTest->testSize(100);
$this->assertEquals($result,100);
}

public function testTestSize_ok_null()
{
$result = $this->classTest->testSize(null);
$this->assertEquals($result,null);
}

public function test_readOnly()
{
$reflectionProperty = new \ReflectionProperty(TText::class, 'editable');
Expand Down

0 comments on commit 803f1ce

Please sign in to comment.