aboutsummaryrefslogtreecommitdiffstats
path: root/tests/version/version_test.php
diff options
context:
space:
mode:
authorMatt Friedman <maf675@gmail.com>2017-03-24 11:45:50 -0700
committerMatt Friedman <maf675@gmail.com>2017-03-24 11:47:28 -0700
commit74054317d2caa08aef05997ad27a52d5ba20f369 (patch)
tree686ba075834f100667fbce9500342d24220a13ca /tests/version/version_test.php
parentafddb81acfa291ba8043d6af974f97abe8ec5243 (diff)
downloadforums-74054317d2caa08aef05997ad27a52d5ba20f369.tar
forums-74054317d2caa08aef05997ad27a52d5ba20f369.tar.gz
forums-74054317d2caa08aef05997ad27a52d5ba20f369.tar.bz2
forums-74054317d2caa08aef05997ad27a52d5ba20f369.tar.xz
forums-74054317d2caa08aef05997ad27a52d5ba20f369.zip
[ticket/15142] Add ext branch update tests
PHPBB3-15142
Diffstat (limited to 'tests/version/version_test.php')
-rw-r--r--tests/version/version_test.php292
1 files changed, 292 insertions, 0 deletions
diff --git a/tests/version/version_test.php b/tests/version/version_test.php
index 54237f2059..0ed0fcb589 100644
--- a/tests/version/version_test.php
+++ b/tests/version/version_test.php
@@ -532,4 +532,296 @@ class phpbb_version_helper_test extends phpbb_test_case
$this->assertSame($expected, $version_helper->get_update_on_branch());
}
+
+ public function get_ext_update_on_branch_data()
+ {
+ return array(
+ // Single branch, check version for current branch
+ array(
+ '3.1.0',
+ '1.0.0',
+ array(
+ '3.1' => array(
+ 'current' => '1.0.1',
+ ),
+ ),
+ array(
+ 'current' => '1.0.1',
+ ),
+ ),
+ array(
+ '3.1.0',
+ '1.0.1',
+ array(
+ '3.1' => array(
+ 'current' => '1.0.1',
+ ),
+ ),
+ array(),
+ ),
+ array(
+ '3.2.0',
+ '1.0.0',
+ array(
+ '3.2' => array(
+ 'current' => '1.1.1',
+ ),
+ ),
+ array(
+ 'current' => '1.1.1',
+ ),
+ ),
+ array(
+ '3.2.0',
+ '1.1.1',
+ array(
+ '3.2' => array(
+ 'current' => '1.1.1',
+ ),
+ ),
+ array(),
+ ),
+ // Single branch, check for newest version when branches don't match up
+ array(
+ '3.1.0',
+ '1.0.0',
+ array(
+ '3.2' => array(
+ 'current' => '1.1.1',
+ ),
+ ),
+ array(
+ 'current' => '1.1.1',
+ ),
+ ),
+ array(
+ '3.1.0',
+ '1.1.1',
+ array(
+ '3.2' => array(
+ 'current' => '1.1.1',
+ ),
+ ),
+ array(),
+ ),
+ array(
+ '3.2.0',
+ '1.0.0',
+ array(
+ '3.1' => array(
+ 'current' => '1.0.1',
+ ),
+ ),
+ array(
+ 'current' => '1.0.1',
+ ),
+ ),
+ array(
+ '3.2.0',
+ '1.0.1',
+ array(
+ '3.1' => array(
+ 'current' => '1.0.1',
+ ),
+ ),
+ array(),
+ ),
+ array(
+ '3.3.0',
+ '1.0.0',
+ array(
+ '3.2' => array(
+ 'current' => '1.1.1',
+ ),
+ ),
+ array(
+ 'current' => '1.1.1',
+ ),
+ ),
+ array(
+ '3.3.0',
+ '1.1.1',
+ array(
+ '3.2' => array(
+ 'current' => '1.1.1',
+ ),
+ ),
+ array(),
+ ),
+ // Multiple branches, check version for current branch
+ array(
+ '3.1.0',
+ '1.0.0',
+ array(
+ '3.1' => array(
+ 'current' => '1.0.1',
+ ),
+ '3.2' => array(
+ 'current' => '1.1.1',
+ ),
+ ),
+ array(
+ 'current' => '1.0.1',
+ ),
+ ),
+ array(
+ '3.1.0',
+ '1.0.1',
+ array(
+ '3.1' => array(
+ 'current' => '1.0.1',
+ ),
+ '3.2' => array(
+ 'current' => '1.1.1',
+ ),
+ ),
+ array(),
+ ),
+ array(
+ '3.1.0',
+ '1.1.1',
+ array(
+ '3.1' => array(
+ 'current' => '1.0.1',
+ ),
+ '3.2' => array(
+ 'current' => '1.1.1',
+ ),
+ ),
+ array(),
+ ),
+ array(
+ '3.2.0',
+ '1.0.0',
+ array(
+ '3.1' => array(
+ 'current' => '1.0.1',
+ ),
+ '3.2' => array(
+ 'current' => '1.1.1',
+ ),
+ ),
+ array(
+ 'current' => '1.1.1',
+ ),
+ ),
+ array(
+ '3.2.0',
+ '1.0.1',
+ array(
+ '3.1' => array(
+ 'current' => '1.0.1',
+ ),
+ '3.2' => array(
+ 'current' => '1.1.1',
+ ),
+ ),
+ array(
+ 'current' => '1.1.1',
+ ),
+ ),
+ array(
+ '3.2.0',
+ '1.1.1',
+ array(
+ '3.1' => array(
+ 'current' => '1.0.1',
+ ),
+ '3.2' => array(
+ 'current' => '1.1.1',
+ ),
+ ),
+ array(),
+ ),
+ // Multiple branches, check for newest version when branches don't match up
+ array(
+ '3.3.0',
+ '1.0.0',
+ array(
+ '3.1' => array(
+ 'current' => '1.0.1',
+ ),
+ '3.2' => array(
+ 'current' => '1.1.1',
+ ),
+ ),
+ array(
+ 'current' => '1.1.1',
+ ),
+ ),
+ array(
+ '3.3.0',
+ '1.0.1',
+ array(
+ '3.1' => array(
+ 'current' => '1.0.1',
+ ),
+ '3.2' => array(
+ 'current' => '1.1.1',
+ ),
+ ),
+ array(
+ 'current' => '1.1.1',
+ ),
+ ),
+ array(
+ '3.3.0',
+ '1.1.0',
+ array(
+ '3.1' => array(
+ 'current' => '1.0.1',
+ ),
+ '3.2' => array(
+ 'current' => '1.1.1',
+ ),
+ ),
+ array(
+ 'current' => '1.1.1',
+ ),
+ ),
+ array(
+ '3.3.0',
+ '1.1.1',
+ array(
+ '3.1' => array(
+ 'current' => '1.0.1',
+ ),
+ '3.2' => array(
+ 'current' => '1.1.1',
+ ),
+ ),
+ array(),
+ ),
+ );
+ }
+
+ /**
+ * @dataProvider get_ext_update_on_branch_data
+ */
+ public function test_get_ext_update_on_branch($phpbb_version, $ext_version, $versions, $expected)
+ {
+ $version_helper = $this
+ ->getMockBuilder('\phpbb\version_helper')
+ ->setMethods(array(
+ 'get_versions_matching_stability',
+ ))
+ ->setConstructorArgs(array(
+ $this->cache,
+ new \phpbb\config\config(array(
+ 'version' => $phpbb_version,
+ )),
+ new \phpbb\file_downloader(),
+ new \phpbb\user('\phpbb\datetime'),
+ ))
+ ->getMock()
+ ;
+
+ $version_helper->expects($this->any())
+ ->method('get_versions_matching_stability')
+ ->will($this->returnValue($versions));
+
+ $version_helper->set_current_version($ext_version);
+
+ $this->assertSame($expected, $version_helper->get_ext_update_on_branch());
+ }
}