/**
  * @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);
         }
     }
 }
 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'));
 }
Example #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'));
         }
     }
 }