Skip to content

Commit

Permalink
[UPD] Ajustes para para phpunit 5.7
Browse files Browse the repository at this point in the history
  • Loading branch information
robmachado committed Mar 12, 2017
1 parent 32661dd commit 21d2379
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 19 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"endroid/qrcode": "1.*@dev"
},
"require-dev": {
"phpunit/phpunit": "4.*",
"phpunit/phpunit": "^5.7",
"scrutinizer/ocular": "~1.1",
"squizlabs/php_codesniffer": "~2.3"
},
Expand Down
26 changes: 8 additions & 18 deletions tests/Common/DateTime/DateTimeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,58 +9,48 @@ class DateTimeTest extends PHPUnit_Framework_TestCase
{
public $tstp = 1424196793;
public $sefTime = '2015-02-17T15:13:13-03:00';

public function testTZD()
{
date_default_timezone_set('America/Sao_Paulo');
$tzP = date('P');
$tzP1 = DateTime::tzdBR('SP');
$this->assertEquals($tzP, $tzP1);
}

public function testConvertSefazTimeToTimestamp()
{
DateTime::tzdBR('CE');
$tsp = DateTime::convertSefazTimeToTimestamp($this->sefTime);
$this->assertEquals($tsp, $this->tstp);
}

public function testConvertTimestampToSefazTime()
{
DateTime::tzdBR('CE');
$seft = DateTime::convertTimestampToSefazTime($this->tstp);
$this->assertEquals($seft, $this->sefTime);
}

public function testConvertTimestampToSefazTimeEmBranco()
{
$dateTime = $this->getMock('\DateTime', array('format'), array('2015-08-01 10:11:09'));
$dateTime->expects($this->once())
->method('format')
->with('Y-m-d H:i:sP')
->will($this->returnValue('2015-08-01T10:11:09-03:00'));

$this->assertEquals('2015-08-01T10:11:09-03:00', DateTime::convertTimestampToSefazTime(0, $dateTime));
}



public function testConvertSefazTimeToTimestampEmBranco()
{
$this->assertEmpty(DateTime::convertSefazTimeToTimestamp());
}

public function testTZDSiglaNaoInformada()
{
$this->assertEmpty(DateTime::tzdBR());
}

/**
* @dataProvider siglasNaoExistentes
*/
public function testTZDSiglaNaoExistente($uf)
{
$this->assertEmpty(DateTime::tzdBR($uf));
}

public function siglasNaoExistentes()
{
return array(
Expand Down

0 comments on commit 21d2379

Please sign in to comment.