TYPO3CMS  8
 All Classes Namespaces Files Functions Variables Pages
DocumentationFileTest.php
Go to the documentation of this file.
1 <?php
2 declare(strict_types=1);
3 namespace TYPO3\CMS\Install\Tests\Unit\UpgradeAnalysis;
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
18 use org\bovigo\vfs\vfsStream;
19 use org\bovigo\vfs\vfsStreamDirectory;
22 
24 {
25 
30 
34  protected $docRoot;
35 
39  public function setUp()
40  {
41  $content_12345 = [
42  '====',
43  'Breaking: #12345 - Issue',
44  '====',
45  '',
46  'some text content',
47  ];
48  $content_45678 = [
49  '====',
50  'Important: #45678 - Issue',
51  '====',
52  '',
53  'Some more text content',
54  ];
55 
56  $content_98574 = [
57  '====',
58  'Important: #98574 - Issue',
59  '====',
60  '',
61  'Something else',
62  '',
63  '.. index:: unittest'
64  ];
65  $content_13579 = [
66  '====',
67  'Breaking: #13579 - Issue',
68  '====',
69  '',
70  'Some more content'
71  ];
72 
73  $structure = [
74  'Changelog' => [
75  '1.2' => [
76  'Breaking-12345-Issue.rst' => implode("\n", $content_12345),
77  'Important-45678-Issue.rst' => implode("\n", $content_45678),
78 
79  ],
80  '2.0' => [
81  'Important-98574-Issue.rst' => implode("\n", $content_98574),
82  ],
83  'master' => [
84  'Breaking-13579-Issue.rst' => implode("\n", $content_13579),
85  'Index.rst' => '',
86  ],
87  ],
88  ];
89 
90  $this->docRoot = vfsStream::setup('root', null, $structure);
91  $this->documentationFileService = new DocumentationFile();
92  }
93 
98  {
99  $expected = [
100  '1.2' => [],
101  '2.0' => [],
102  'master' => [],
103  ];
104 
105  $result = $this->documentationFileService->findDocumentationFiles(vfsStream::url('root/Changelog'));
106  self::assertEquals(array_keys($expected), array_keys($result));
107  }
108 
113  {
114  $expected = [
115  'unittest',
116  'cat:Important',
117  ];
118  $result = $this->documentationFileService->findDocumentationFiles(vfsStream::url('root/Changelog'));
119  self::assertEquals($expected, $result['2.0'][98574]['tags']);
120  }
121 }