public function MongoDbProfilerStorageTest::testUtf8 in Zircon Profile 8.0
Same name and namespace in other branches
- 8 vendor/symfony/http-kernel/Tests/Profiler/MongoDbProfilerStorageTest.php \Symfony\Component\HttpKernel\Tests\Profiler\MongoDbProfilerStorageTest::testUtf8()
File
- vendor/
symfony/ http-kernel/ Tests/ Profiler/ MongoDbProfilerStorageTest.php, line 127
Class
Namespace
Symfony\Component\HttpKernel\Tests\ProfilerCode
public function testUtf8() {
$profile = new Profile('utf8_test_profile');
$data = 'HЁʃʃϿ, ϢorЃd!';
$nonUtf8Data = mb_convert_encoding($data, 'UCS-2');
$collector = new MongoDbProfilerStorageTestDataCollector();
$collector
->setData($nonUtf8Data);
$profile
->setCollectors(array(
$collector,
));
self::$storage
->write($profile);
$readProfile = self::$storage
->read('utf8_test_profile');
$collectors = $readProfile
->getCollectors();
$this
->assertCount(1, $collectors);
$this
->assertArrayHasKey('test_data_collector', $collectors);
$this
->assertEquals($nonUtf8Data, $collectors['test_data_collector']
->getData(), 'Non-UTF8 data is properly encoded/decoded');
}