/**
  * @dataProvider updateDataProvider
  */
 public function testUpdate($first, $second, $expected)
 {
     $aggregate = new Aggregate();
     $aggregate->update('test', $first);
     $aggregate->update('test', $second);
     $coverage = $aggregate->getCoverage();
     $this->assertTrue(is_array($coverage));
     $this->assertCount(1, $coverage);
     $this->assertEquals($expected, $coverage['test']);
 }
Пример #2
0
 /**
  * {@inheritdoc}
  */
 public function stop()
 {
     $aggregate = new Aggregate();
     foreach ($this->drivers as $driver) {
         $coverage = $driver->stop();
         if (!$coverage) {
             continue;
         }
         foreach ($coverage as $class => $counts) {
             $aggregate->update($class, $counts);
         }
     }
     return $aggregate->getCoverage();
 }
 /**
  * Get coverage
  *
  * @return array
  */
 public function getCoverage()
 {
     $aggregate = new Aggregate();
     $resultSet = array();
     $sqlite = $this->newSQLiteInstance();
     $result = @$sqlite->query('SELECT class, counts FROM coverage');
     if (!$result) {
         return array();
     }
     while ($res = $result->fetchArray(SQLITE3_ASSOC)) {
         $resultSet[] = $res;
     }
     if ($resultSet !== false) {
         foreach ($resultSet as $result) {
             $counts = json_decode($result['counts'], true);
             $aggregate->update($result['class'], $counts);
         }
     }
     return $aggregate->getCoverage();
 }