You are here

public function FileProfilerStorageTest::testMultiRowIndexFile in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/http-kernel/Tests/Profiler/FileProfilerStorageTest.php \Symfony\Component\HttpKernel\Tests\Profiler\FileProfilerStorageTest::testMultiRowIndexFile()

File

vendor/symfony/http-kernel/Tests/Profiler/FileProfilerStorageTest.php, line 62

Class

FileProfilerStorageTest

Namespace

Symfony\Component\HttpKernel\Tests\Profiler

Code

public function testMultiRowIndexFile() {
  $iteration = 3;
  for ($i = 0; $i < $iteration; ++$i) {
    $profile = new Profile('token' . $i);
    $profile
      ->setIp('127.0.0.' . $i);
    $profile
      ->setUrl('http://foo.bar/' . $i);
    $storage = $this
      ->getStorage();
    $storage
      ->write($profile);
    $storage
      ->write($profile);
    $storage
      ->write($profile);
  }
  $handle = fopen(self::$tmpDir . '/index.csv', 'r');
  for ($i = 0; $i < $iteration; ++$i) {
    $row = fgetcsv($handle);
    $this
      ->assertEquals('token' . $i, $row[0]);
    $this
      ->assertEquals('127.0.0.' . $i, $row[1]);
    $this
      ->assertEquals('http://foo.bar/' . $i, $row[3]);
  }
  $this
    ->assertFalse(fgetcsv($handle));
}