예제 #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());
 }