示例#1
0
 /**
  * Test the author mapping against ignored authors.
  *
  * @return void
  */
 public function testIgnoredAuthorMapping()
 {
     $config = new Config();
     $config->aliasAuthor('Author Alias <*****@*****.**>', 'Real Author <*****@*****.**>');
     $config->aliasAuthor('Ignored Alias <*****@*****.**>', 'Real Author <*****@*****.**>');
     $config->aliasAuthor('Ignored Alias2 <*****@*****.**>', 'Ignored Author <*****@*****.**>');
     $config->ignoreAuthors(array('Ignored Author <*****@*****.**>', 'Ignored Alias <*****@*****.**>'));
     $this->assertFalse($config->isAlias('Real Author <*****@*****.**>'));
     $this->assertFalse($config->isAlias('Ignored Author <*****@*****.**>'));
     $this->assertNull($config->getRealAuthor('Ignored Author <*****@*****.**>'));
     $this->assertNull($config->getRealAuthor('Ignored Alias <*****@*****.**>'));
     $this->assertNull($config->getRealAuthor('Ignored Alias2 <*****@*****.**>'));
     $this->assertEquals('Real Author <*****@*****.**>', $config->getRealAuthor('Real Author <*****@*****.**>'));
     $this->assertEquals('Real Author <*****@*****.**>', $config->getRealAuthor('Author Alias <*****@*****.**>'));
 }
 /**
  * {@inheritDoc}
  */
 public function extractAuthorsFor($path)
 {
     if (!isset($this->cachedResult[$path])) {
         $result = $this->beautifyAuthorList($this->doExtract($path));
         if (is_array($result)) {
             $authors = array();
             foreach ($result as $author) {
                 $author = $this->config->getRealAuthor($author);
                 if ($author) {
                     $authors[strtolower($author)] = $author;
                 }
             }
             $result = $authors;
         }
         $this->cachedResult[$path] = $result;
     }
     return $this->cachedResult[$path];
 }