/**
  * @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']));
 }
Ejemplo n.º 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');
 }
Ejemplo n.º 3
0
 /**
  * @param PluginDownloadsFetchedEvent $event
  */
 public function onDownloadsFetched(PluginDownloadsFetchedEvent $event)
 {
     $this->storage->put($event->getId(), $event->getDownloads());
 }