示例#1
0
 /**
  * Load stats
  *
  * @param EventInterface $event An event instance
  */
 public function loadStats(EventInterface $event)
 {
     $response = $event->getResponse();
     $database = $event->getDatabase();
     $userLookup = $event->getUserLookup();
     $publicKeys = $userLookup->getPublicKeys();
     $users = array();
     foreach ($publicKeys as $key) {
         $users[$key] = array('numImages' => $database->getNumImages($key), 'numBytes' => $database->getNumBytes($key));
     }
     $statsModel = new Model\Stats();
     $statsModel->setUsers($users);
     $response->setModel($statsModel);
 }
示例#2
0
文件: StatsTest.php 项目: ASP96/imbo
 /**
  * @dataProvider getUsers
  * @covers Imbo\Model\Stats::getNumBytes
  */
 public function testCanGetTotalAmountOfBytes(array $users, $numUsers, $images, $bytes)
 {
     $this->model->setUsers($users);
     $this->assertSame($bytes, $this->model->getNumBytes());
 }