Skip to content

Commit

Permalink
Added test cases.
Browse files Browse the repository at this point in the history
  • Loading branch information
limingxinleo committed Nov 23, 2023
1 parent abf9af2 commit 6a1618b
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/Cases/ChannelTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use Hyperf\Engine\Channel;
use Hyperf\Engine\Contract\ChannelInterface;
use Hyperf\Engine\Coroutine;
use stdClass;

/**
* @internal
Expand Down Expand Up @@ -182,4 +183,16 @@ public function testChannelIsClosing()
$this->assertFalse($channel->isAvailable());
});
}

public function testSplId()
{
$this->runInCoroutine(function () {
$obj = new stdClass();
$chan = new Channel(1);
$chan->push($obj);

$this->assertSame(spl_object_id($obj), spl_object_id($assert = $chan->pop()));
$this->assertSame(spl_object_hash($obj), spl_object_hash($assert));
});
}
}

0 comments on commit 6a1618b

Please sign in to comment.