예제 #1
0
 /**
  * @param ModerationLog $log
  *
  * @return ContentInterface
  */
 private function getSourceFromLog(ModerationLog $log)
 {
     if ($log->source_content_type && $log->source_content_id) {
         $repository = $this->repositoryFactory->build($log->source_content_type);
         if ($repository) {
             return $repository->find($log->source_content_id);
         }
     }
 }
예제 #2
0
 public function testCanHandleWhenRegistryReturnsNull()
 {
     $registry = Mockery::mock('MyBB\\Core\\Repository\\RepositoryRegistry');
     $registry->shouldReceive('get')->with('foo')->andReturnNull();
     $application = Mockery::mock('Illuminate\\Contracts\\Foundation\\Application');
     $application->shouldReceive('make')->never();
     $factory = new RepositoryFactory($registry, $application);
     static::assertNull($factory->build('foo'));
 }
예제 #3
0
 /**
  * @return ContentInterface
  */
 public function getSource()
 {
     if ($this->getModeration() instanceof SourceableInterface) {
         $sourceRepository = $this->repositoryFactory->build($this->get('moderation_source_type'));
         if ($sourceRepository) {
             return $sourceRepository->find($this->get('moderation_source_id'));
         }
     }
 }