1<?php
2
3/**
4 * Version parsing tests for the elwikiupgrade plugin
5 *
6 * @group plugin_elwikiupgrade
7 * @group plugins
8 */
9class version_plugin_elwikiupgrade_test extends DokuWikiTest
10{
11    /**
12     * @return array
13     * @see testVersions
14     */
15    public function provideVersions()
16    {
17        return [
18            ['2018-04-22c "Greebo"', '2018-04-22'],
19            ['rc2020-06-01 "Hogfather"', '2020-06-01'],
20            ['rc2-2020-06-01 "Hogfather" RC2', '2020-06-01'],
21            ['Git 2020-06-03', '2020-06-03'],
22            ['rc2013-11-18 "Binky RC2"', '2013-11-18'],
23            ['foobar', 0],
24        ];
25    }
26
27    /**
28     * @dataProvider provideVersions
29     * @param string $version
30     * @param string $expected
31     */
32    public function testVersions($version, $expected)
33    {
34        $plugin = new admin_plugin_elwikiupgrade();
35
36        $this->assertSame($expected, $plugin->dateFromVersion($version));
37    }
38
39}
40