-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into 3.0-merge
- Loading branch information
Showing
5 changed files
with
103 additions
and
37 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
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,36 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
/** | ||
* This file is part of Hyperf. | ||
* | ||
* @link https://www.hyperf.io | ||
* @document https://hyperf.wiki | ||
* @contact group@hyperf.io | ||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE | ||
*/ | ||
namespace HyperfTest\Testing; | ||
|
||
use Hyperf\Testing\Debug; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
/** | ||
* @internal | ||
* @coversNothing | ||
*/ | ||
class DebugTest extends TestCase | ||
{ | ||
public function testGetRefCount() | ||
{ | ||
$this->assertSame('1', Debug::getRefCount(new \stdClass())); | ||
$obj = new \stdClass(); | ||
$this->assertSame('2', Debug::getRefCount($obj)); | ||
$obj2 = new \stdClass(); | ||
$obj2->obj = $obj; | ||
$this->assertSame('2', Debug::getRefCount($obj2)); | ||
$this->assertSame('3', Debug::getRefCount($obj)); | ||
$fun = static function () {}; | ||
$this->assertSame('2', Debug::getRefCount($fun)); | ||
$this->assertSame('1', Debug::getRefCount(function () {})); | ||
} | ||
} |
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