Skip to content

Commit

Permalink
Add internal function replacement
Browse files Browse the repository at this point in the history
  • Loading branch information
xepozz committed Feb 24, 2024
1 parent be8669e commit 2a60234
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/UnixInternalFunctions.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

declare(strict_types=1);

namespace Xepozz\InternalMocker;

class UnixInternalFunctions
{
public static function time(): int
{
return (int) `date +%s`;
}
}
16 changes: 16 additions & 0 deletions tests/Integration/UnitInternalFunctionsTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

declare(strict_types=1);

namespace Xepozz\InternalMocker\Tests\Integration;

use PHPUnit\Framework\TestCase;
use Xepozz\InternalMocker\UnixInternalFunctions;

final class UnitInternalFunctionsTest extends TestCase
{
public function testTime()
{
$this->assertEquals(`date +%s`, UnixInternalFunctions::time());
}
}

0 comments on commit 2a60234

Please sign in to comment.