Skip to content

Commit b46054a

Browse files
authored
Splitting the crontab component (#55)
* Splitting the crontab component
1 parent a39000e commit b46054a

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

tests/Cases/Middleware/I18nMiddlewareTest.php

+8-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
use Hyperf\Contract\ConfigInterface;
1818
use Hyperf\Contract\StdoutLoggerInterface;
1919
use Hyperf\Contract\TranslatorInterface;
20+
use Hyperf\Di\Container;
21+
use Hyperf\Di\Definition\DefinitionSourceFactory;
22+
use Hyperf\Di\Exception\Exception;
2023
use Mine\HttpServer\Contract\Log\RequestIdGeneratorInterface;
2124
use Mine\HttpServer\Log\RequestIdGenerator;
2225
use Mine\HttpServer\Middleware\I18nMiddleware;
@@ -32,8 +35,12 @@
3235
*/
3336
class I18nMiddlewareTest extends TestCase
3437
{
38+
/**
39+
* @throws Exception
40+
*/
3541
protected function setUp(): void
3642
{
43+
ApplicationContext::setContainer(new Container((new DefinitionSourceFactory())()));
3744
$config = new Config([
3845
StdoutLoggerInterface::class => [
3946
LogLevel::DEBUG,
@@ -58,9 +65,9 @@ protected function setUp(): void
5865

5966
public function testProcess(): void
6067
{
68+
$translator = ApplicationContext::getContainer()->get(TranslatorInterface::class);
6169
$instance = ApplicationContext::getContainer()->get(I18nMiddleware::class);
6270
$request = \Mockery::mock(ServerRequestInterface::class);
63-
$translator = ApplicationContext::getContainer()->get(TranslatorInterface::class);
6471
$request->allows('hasHeader')
6572
->andReturn(false, true, true, true, true);
6673
$request->allows('getHeaderLine')

tests/Cases/ResultTest.php

+7
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
use Hyperf\Context\ApplicationContext;
1717
use Hyperf\Contract\ConfigInterface;
1818
use Hyperf\Contract\StdoutLoggerInterface;
19+
use Hyperf\Di\Container;
20+
use Hyperf\Di\Definition\DefinitionSourceFactory;
21+
use Hyperf\Di\Exception\Exception;
1922
use Mine\HttpServer\Constant\HttpResultCode;
2023
use Mine\HttpServer\Contract\Log\RequestIdGeneratorInterface;
2124
use Mine\HttpServer\Log\RequestIdGenerator;
@@ -30,8 +33,12 @@
3033
*/
3134
class ResultTest extends TestCase
3235
{
36+
/**
37+
* @throws Exception
38+
*/
3339
protected function setUp(): void
3440
{
41+
ApplicationContext::setContainer(new Container((new DefinitionSourceFactory())()));
3542
$config = new Config([
3643
StdoutLoggerInterface::class => [
3744
LogLevel::DEBUG,

0 commit comments

Comments
 (0)