for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Graze\CiffRenderer\Test\Unit\Parser\FieldParser\DateFormatter;
use Mockery as m;
use Urbanplum\DotnetDateTime\DotnetDateTime;
use Graze\CiffRenderer\Parser\FieldParser\DateFormatter\DateFormatterBasic;
class DateFormatterBasicTest extends \PHPUnit_Framework_TestCase
{
public function testFormat()
$formatDotNet = 'i am format dotnet';
$formatPhp = 'i am format php';
$dotnetDateTime = m::mock(DotnetDateTime::class)
->shouldReceive('formatToPhp')
->with($formatDotNet)
->andReturn($formatPhp)
->once()
->getMock();
$expected = 'i am expected';
$date = m::mock(\DateTimeImmutable::class)
->shouldReceive('format')
->with($formatPhp)
->andReturn($expected)
$formatter = new DateFormatterBasic($dotnetDateTime);
$actual = $formatter->format($date, $formatDotNet);
$this->assertSame($expected, $actual);
}