Esempio n. 1
0
 /**
  * @return \MyBB\Core\Moderation\ModerationInterface[]
  */
 public function moderations()
 {
     $moderations = $this->moderations->getForContent(new Post());
     $decorated = [];
     $presenter = $this->app->make('autopresenter');
     foreach ($moderations as $moderation) {
         $decorated[] = $presenter->decorate($moderation);
     }
     return $decorated;
 }
 public function testGetForContentReturnsSomeForSomeSupportedContent()
 {
     $moderation1 = Mockery::mock('MyBB\\Core\\Moderation\\ModerationInterface');
     $moderation1->shouldReceive('getKey')->withNoArgs()->andReturn('key1');
     $moderation1->shouldReceive('visible')->with('content')->andReturn(true);
     $moderation2 = Mockery::mock('MyBB\\Core\\Moderation\\ModerationInterface');
     $moderation2->shouldReceive('getKey')->withNoArgs()->andReturn('key2');
     $moderation2->shouldReceive('visible')->with('content')->andReturn(false);
     $registry = new ModerationRegistry();
     $registry->addModeration($moderation1);
     $registry->addModeration($moderation2);
     $moderations = $registry->getForContent('content');
     static::assertCount(1, $moderations);
     static::assertContains($moderation1, $moderations);
 }