1 | <?php |
||
2 | |||
3 | namespace SilverStripe\ModuleRatings\Tests\Check; |
||
4 | |||
5 | use PHPUnit\Framework\TestCase; |
||
6 | use SilverStripe\ModuleRatings\Check\DocumentationCheck; |
||
7 | use SilverStripe\ModuleRatings\CheckSuite; |
||
8 | use Symfony\Component\Finder\Finder; |
||
9 | |||
10 | class DocumentationCheckTest extends TestCase |
||
11 | { |
||
12 | /** |
||
13 | * @dataProvider runProvider |
||
14 | * @param string[] $filenames |
||
15 | * @param bool $expected |
||
16 | */ |
||
17 | public function testRun($filenames, $expected) |
||
18 | { |
||
19 | // Set up the Finder mock |
||
20 | $finder = $this->getMockBuilder(Finder::class) |
||
0 ignored issues
–
show
|
|||
21 | ->setMethods(['directories', 'in', 'name']) |
||
22 | ->getMock(); |
||
23 | |||
24 | $finder->expects($this->once())->method('directories')->will($this->returnSelf()); |
||
25 | $finder->expects($this->once())->method('in')->will($this->returnSelf()); |
||
26 | $finder->expects($this->once())->method('name')->willReturn($filenames); |
||
27 | |||
28 | $check = new DocumentationCheck(); |
||
29 | $check->setSuite(new CheckSuite()); |
||
30 | $check->setFinder($finder); |
||
31 | $check->run(); |
||
32 | |||
33 | $this->assertSame($expected, $check->getSuccessful()); |
||
34 | } |
||
35 | |||
36 | /** |
||
37 | * @return array[] |
||
38 | */ |
||
39 | public function runProvider() |
||
40 | { |
||
41 | return [ |
||
42 | 'docs folder' => [['doc'], true], |
||
43 | 'doc folder' => [['docs'], true], |
||
44 | ]; |
||
45 | } |
||
46 | } |
||
47 |
This function has been deprecated. The supplier of the function has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.