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