/**
  * @covers \espend\IdeaBadge\Poser\Provider\PoserLastMonthStorage::put
  */
 public function testThatCurrentMonthIsSaved()
 {
     $storage = new PoserLastMonthStorage($this->temp);
     $storage->put('5000', 500000);
     $json = json_decode(file_get_contents($this->temp), true);
     static::assertEquals(500000, current($json['5000']));
 }
Пример #2
0
 /**
  * {@inheritdoc}
  */
 public function getPoser($id)
 {
     $count = 'n/a';
     if ($downloads = $this->storage->fetch($id)) {
         $count = $this->normalizer->normalize($downloads);
     }
     return new PoserBadge('downloads', sprintf('%s last month', $count), '097ABB');
 }
 /**
  * @param PluginDownloadsFetchedEvent $event
  */
 public function onDownloadsFetched(PluginDownloadsFetchedEvent $event)
 {
     $this->storage->put($event->getId(), $event->getDownloads());
 }