Closed dieend closed 4 years ago
It would be great to add unit test like this:
tests/Fluent/Logger/MsgpackPackerTest.php:
<?php namespace FluentTests\Logger; use Fluent\Logger\Entity; use Fluent\Logger\MsgpackPacker; class MsgpackPackerTest extends \PHPUnit_Framework_TestCase { const TAG = "debug.test"; const EXPECTED_TIME = 123456789; protected $time; protected $expected_data = array(); public function setUp() { $this->expected_data = array("abc" => "def"); } public function testPack() { $entity = new Entity(self::TAG, $this->expected_data, self::EXPECTED_TIME); if (function_exists('msgpack_pack') && function_exists('msgpack_unpack')) { $packer = new MsgpackPacker(); $packed = $packer->pack($entity); $unpacked = msgpack_unpack($packed); // for comparison in assertion $expected = (array(self::TAG, self::EXPECTED_TIME, $this->expected_data)); $this->assertArraySubset($expected, $unpacked); } else { $this->markTestSkipped('Skipped MsgpackPackerTest::testPack.'); } } }
What happened to the msgpack Packer, i was able to add manually but wondering why it is no longer included?
It would be great to add unit test like this:
tests/Fluent/Logger/MsgpackPackerTest.php: