Skip to content

Commit

Permalink
Merge pull request #16 from michael-rubel/cleanup/move-example-formatter
Browse files Browse the repository at this point in the history
Cleanup in package directory
  • Loading branch information
michael-rubel committed Sep 7, 2022
2 parents 977b981 + 7dbda56 commit b443006
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 24 deletions.
23 changes: 0 additions & 23 deletions app/Formatters/ExampleFormatter.php

This file was deleted.

4 changes: 3 additions & 1 deletion tests/FormatterConfigTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ public function testConfigSettingsAndProviderFiles()
/** @test */
public function testBaseDirectorySetsCorrectly()
{
app()->setBasePath(__DIR__ . '/../');
app()->setBasePath(__DIR__);

config(['formatters.folder' => 'Formatters']);

$mock = $this->partialMock(Filesystem::class, function (MockInterface $mock) {
$mock->shouldReceive('isDirectory')
Expand Down
30 changes: 30 additions & 0 deletions tests/Formatters/ExampleFormatter.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php

declare(strict_types=1);

namespace App\Formatters;

use Carbon\CarbonInterface;
use MichaelRubel\Formatters\Formatter;

class ExampleFormatter implements Formatter
{
/**
* @param CarbonInterface $carbon
*/
public function __construct(
public CarbonInterface $carbon
) {
//
}

/**
* Format the date.
*
* @return string|null
*/
public function format(): ?string
{
return $this->carbon->toDateTimeString();
}
}

0 comments on commit b443006

Please sign in to comment.