You are here

public function Twig_Tests_Profiler_ProfileTest::testSerialize in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/twig/twig/test/Twig/Tests/Profiler/ProfileTest.php \Twig_Tests_Profiler_ProfileTest::testSerialize()

File

vendor/twig/twig/test/Twig/Tests/Profiler/ProfileTest.php, line 78

Class

Twig_Tests_Profiler_ProfileTest

Code

public function testSerialize() {
  $profile = new Twig_Profiler_Profile('template', 'type', 'name');
  $profile1 = new Twig_Profiler_Profile('template1', 'type1', 'name1');
  $profile
    ->addProfile($profile1);
  $profile
    ->leave();
  $profile1
    ->leave();
  $profile2 = unserialize(serialize($profile));
  $profiles = $profile
    ->getProfiles();
  $this
    ->assertCount(1, $profiles);
  $profile3 = $profiles[0];
  $this
    ->assertEquals($profile
    ->getTemplate(), $profile2
    ->getTemplate());
  $this
    ->assertEquals($profile
    ->getType(), $profile2
    ->getType());
  $this
    ->assertEquals($profile
    ->getName(), $profile2
    ->getName());
  $this
    ->assertEquals($profile
    ->getDuration(), $profile2
    ->getDuration());
  $this
    ->assertEquals($profile1
    ->getTemplate(), $profile3
    ->getTemplate());
  $this
    ->assertEquals($profile1
    ->getType(), $profile3
    ->getType());
  $this
    ->assertEquals($profile1
    ->getName(), $profile3
    ->getName());
}