-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from xepozz/support-internal-functions
Support internal functions mock
- Loading branch information
Showing
6 changed files
with
156 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,26 @@ | ||
{ | ||
"name": "xepozz/internal-mocker", | ||
"type": "library", | ||
"autoload": { | ||
"psr-4": { | ||
"Xepozz\\InternalMocker\\": "src/" | ||
} | ||
}, | ||
"autoload-dev": { | ||
"psr-4": { | ||
"Xepozz\\InternalMocker\\Tests\\": "tests/" | ||
} | ||
}, | ||
"authors": [ | ||
{ | ||
"name": "Dmitrii Derepko", | ||
"email": "[email protected]" | ||
} | ||
], | ||
"require": { | ||
"yiisoft/var-dumper": "^1.2" | ||
}, | ||
"require-dev": { | ||
"phpunit/phpunit": "^9.5" | ||
}, | ||
"require": { | ||
"yiisoft/var-dumper": "^1.2" | ||
"autoload": { | ||
"psr-4": { | ||
"Xepozz\\InternalMocker\\": "src/" | ||
} | ||
}, | ||
"autoload-dev": { | ||
"psr-4": { | ||
"Xepozz\\InternalMocker\\Tests\\": "tests/" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Xepozz\InternalMocker\Tests\Integration; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
use Xepozz\InternalMocker\MockerState; | ||
|
||
use function time; | ||
|
||
final class TimeTest extends TestCase | ||
{ | ||
public function testRun() | ||
{ | ||
$this->assertEquals(`date +%s`, time()); | ||
} | ||
|
||
public function testRun2() | ||
{ | ||
MockerState::addCondition( | ||
'', | ||
'time', | ||
[], | ||
100 | ||
); | ||
|
||
$this->assertEquals(100, time()); | ||
} | ||
|
||
public function testRun3() | ||
{ | ||
$this->assertEquals(`date +%s`, time()); | ||
} | ||
|
||
public function testRun4() | ||
{ | ||
$now = time(); | ||
sleep(1); | ||
$next = time(); | ||
|
||
$this->assertEquals(1, $next - $now); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.