/**
  * @dataProvider revUserDeleteProvider
  */
 public function testNewForRevUserDeleteChange($expected, $context, $messages, $recentChange, $watched)
 {
     $cacheEntryFactory = new RCCacheEntryFactory($context, $messages);
     $cacheEntry = $cacheEntryFactory->newFromRecentChange($recentChange, $watched);
     $this->assertInstanceOf('RCCacheEntry', $cacheEntry);
     $this->assertEquals($watched, $cacheEntry->watched, 'watched');
     $this->assertEquals($expected['timestamp'], $cacheEntry->timestamp, 'timestamp');
     $this->assertEquals($expected['numberofWatchingusers'], $cacheEntry->numberofWatchingusers, 'watching users');
     $this->assertEquals($expected['unpatrolled'], $cacheEntry->unpatrolled, 'unpatrolled');
     $this->assertRevDel($cacheEntry);
     $this->assertTitleLink('Zzz', $cacheEntry);
     $this->assertEquals('cur', $cacheEntry->curlink, 'cur link for delete log or rev');
     $this->assertEquals('diff', $cacheEntry->difflink, 'diff link for delete log or rev');
     $this->assertEquals('prev', $cacheEntry->lastlink, 'pref link for delete log or rev');
 }
 public function testNewForRevUserDeleteChange()
 {
     $user = $this->getMutableTestUser()->getUser();
     $recentChange = $this->testRecentChangesHelper->makeDeletedEditRecentChange($user, 'Zzz', '20131103212153', 191, 190, '20131103212153', 0, 0);
     $cacheEntryFactory = new RCCacheEntryFactory($this->getContext(), $this->getMessages(), $this->linkRenderer);
     $cacheEntry = $cacheEntryFactory->newFromRecentChange($recentChange, false);
     $this->assertInstanceOf('RCCacheEntry', $cacheEntry);
     $this->assertEquals(false, $cacheEntry->watched, 'watched');
     $this->assertEquals('21:21', $cacheEntry->timestamp, 'timestamp');
     $this->assertEquals(0, $cacheEntry->numberofWatchingusers, 'watching users');
     $this->assertEquals(false, $cacheEntry->unpatrolled, 'unpatrolled');
     $this->assertRevDel($cacheEntry);
     $this->assertTitleLink('Zzz', $cacheEntry);
     $this->assertEquals('cur', $cacheEntry->curlink, 'cur link for delete log or rev');
     $this->assertEquals('diff', $cacheEntry->difflink, 'diff link for delete log or rev');
     $this->assertEquals('prev', $cacheEntry->lastlink, 'pref link for delete log or rev');
 }
Ejemplo n.º 3
0
 /**
  * Format a line for enhanced recentchange (aka with javascript and block of lines).
  *
  * @param RecentChange $baseRC
  * @param bool $watched
  *
  * @return string
  */
 public function recentChangesLine(&$baseRC, $watched = false)
 {
     $date = $this->getLanguage()->userDate($baseRC->mAttribs['rc_timestamp'], $this->getUser());
     $ret = '';
     # If it's a new day, add the headline and flush the cache
     if ($date != $this->lastdate) {
         # Process current cache
         $ret = $this->recentChangesBlock();
         $this->rc_cache = array();
         $ret .= Xml::element('h4', null, $date) . "\n";
         $this->lastdate = $date;
     }
     $cacheEntry = $this->cacheEntryFactory->newFromRecentChange($baseRC, $watched);
     $this->addCacheEntry($cacheEntry);
     return $ret;
 }
 public function getCacheEntry($recentChange)
 {
     $rcCacheFactory = new RCCacheEntryFactory(new RequestContext(), ['diff' => 'diff', 'cur' => 'cur', 'last' => 'last'], new LinkRenderer(MediaWikiServices::getInstance()->getTitleFormatter()));
     return $rcCacheFactory->newFromRecentChange($recentChange, false);
 }
 public function getCacheEntry($recentChange)
 {
     $rcCacheFactory = new RCCacheEntryFactory(new RequestContext(), array('diff' => 'diff', 'cur' => 'cur', 'last' => 'last'));
     return $rcCacheFactory->newFromRecentChange($recentChange, false);
 }