/**
 * @param NotifFactory $factory
 * @param string $registerRequestString
 * @return Notif|null
 */
function makeNotif(NotifFactory $factory, $registerRequestString)
{
    $reqArr = json_decode($registerRequestString, true);
    if (!is_array($reqArr)) {
        // TODO: add error handling
        return null;
    }
    if (!array_key_exists('fired', $reqArr)) {
        $reqArr['fired'] = false;
    }
    $notif = $factory->make($reqArr);
    return $notif;
}
 public function testList()
 {
     $notifFactory = new NotifFactory();
     $notifList = array();
     for ($i = 0; $i < 3; $i++) {
         $rawData = array('appid' => 111, 'snsid' => '675097095878591' . '_' . $i, 'feature' => 'feature111', 'template' => 'template111', 'trackRef' => 'ref111', 'fireTime' => time() + 100, 'fired' => false);
         $notifList[] = $notifFactory->make($rawData);
     }
     $fbNotifFactory = new FBNotifFactory();
     $fbNotifList = $fbNotifFactory->makeList($notifList);
     static::assertTrue(is_array($fbNotifList) && count($fbNotifList) === count($notifList));
     $fbNotifList2 = array();
     foreach ($notifList as $notif) {
         $fbNotifList2[] = $fbNotifFactory->make($notif);
     }
     static::assertEquals($fbNotifList, $fbNotifList2);
 }