Skip to content

Commit ec6c8f9

Browse files
committed
test
1 parent ce362d1 commit ec6c8f9

File tree

3 files changed

+47
-2
lines changed

3 files changed

+47
-2
lines changed

composer.json

+4-2
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,13 @@
1515
"php": ">=7.1.0",
1616
"ext-swoole":"^4.0",
1717
"easyswoole/swoole-ide-helper": "^1.2",
18-
"easyswoole/utility": "^1.0"
18+
"easyswoole/utility": "^1.0",
19+
"easyswoole/phpunit": "^1.0"
1920
},
2021
"autoload": {
2122
"psr-4": {
22-
"EasySwoole\\Component\\": "src/"
23+
"EasySwoole\\Component\\": "src/",
24+
"EasySwoole\\Component\\Tests\\": "Tests/"
2325
}
2426
}
2527
}

tests/PoolObject.php

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
/**
3+
* Created by PhpStorm.
4+
* User: yf
5+
* Date: 2019-01-06
6+
* Time: 22:48
7+
*/
8+
9+
namespace EasySwoole\Component\Tests;
10+
11+
12+
class PoolObject
13+
{
14+
function fuck(){
15+
return static::class;
16+
}
17+
}

tests/PoolTest.php

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php
2+
/**
3+
* Created by PhpStorm.
4+
* User: yf
5+
* Date: 2019-01-06
6+
* Time: 22:47
7+
*/
8+
9+
namespace EasySwoole\Component\Tests;
10+
11+
12+
use EasySwoole\Component\Pool\PoolManager;
13+
use PHPUnit\Framework\TestCase;
14+
15+
class PoolTest extends TestCase
16+
{
17+
function testNormalClass()
18+
{
19+
$pool = PoolManager::getInstance()->getPool(PoolObject::class);
20+
/**
21+
* @var $obj PoolObject
22+
*/
23+
$obj = $pool->getObj();
24+
$this->assertEquals(PoolObject::class,$obj->fuck());
25+
}
26+
}

0 commit comments

Comments
 (0)