from PHPUnitKit.tests import unittest

from PHPUnitKit.plugin import is_valid_php_version_file_version


class TestIsValidPhpVersionFileVersion(unittest.TestCase):

    def test_invalid_values(self):
        self.assertFalse(is_valid_php_version_file_version(''))
        self.assertFalse(is_valid_php_version_file_version(' '))
        self.assertFalse(is_valid_php_version_file_version('foobar'))
        self.assertFalse(is_valid_php_version_file_version('masterfoo'))
        self.assertFalse(is_valid_php_version_file_version('.'))
        self.assertFalse(is_valid_php_version_file_version('x'))
        self.assertFalse(is_valid_php_version_file_version('x.x'))
        self.assertFalse(is_valid_php_version_file_version('x.x.x'))
        self.assertFalse(is_valid_php_version_file_version('x'))
        self.assertFalse(is_valid_php_version_file_version('snapshot'))

    def test_master_branch_version(self):
        self.assertTrue(is_valid_php_version_file_version('master'))

    def test_specific_semver_versions(self):
        self.assertTrue(is_valid_php_version_file_version('5.0.0'))
        self.assertTrue(is_valid_php_version_file_version('5.0.1'))
        self.assertTrue(is_valid_php_version_file_version('5.0.7'))
        self.assertTrue(is_valid_php_version_file_version('5.0.30'))
        self.assertTrue(is_valid_php_version_file_version('5.0.32'))
        self.assertTrue(is_valid_php_version_file_version('5.1.0'))
        self.assertTrue(is_valid_php_version_file_version('5.1.1'))
        self.assertTrue(is_valid_php_version_file_version('5.1.3'))
        self.assertTrue(is_valid_php_version_file_version('5.1.27'))
        self.assertTrue(is_valid_php_version_file_version('7.0.0'))
        self.assertTrue(is_valid_php_version_file_version('7.1.19'))

    def test_minor_versions(self):
        self.assertTrue(is_valid_php_version_file_version('5.6'))
        self.assertTrue(is_valid_php_version_file_version('7.1'))
        self.assertTrue(is_valid_php_version_file_version('7.2'))

    def test_major_dot_x_versions(self):
        self.assertTrue(is_valid_php_version_file_version('5.x'))
        self.assertTrue(is_valid_php_version_file_version('6.x'))
        self.assertTrue(is_valid_php_version_file_version('7.x'))
        self.assertTrue(is_valid_php_version_file_version('8.x'))

    def test_major_dot_minor_dot_x_versions(self):
        self.assertTrue(is_valid_php_version_file_version('7.0.x'))
        self.assertTrue(is_valid_php_version_file_version('7.1.x'))
        self.assertTrue(is_valid_php_version_file_version('7.2.x'))

    def test_snapshot_versions(self):
        self.assertTrue(is_valid_php_version_file_version('5.4snapshot'))
        self.assertTrue(is_valid_php_version_file_version('5.5snapshot'))
        self.assertTrue(is_valid_php_version_file_version('5.6snapshot'))
        self.assertTrue(is_valid_php_version_file_version('7.0snapshot'))
        self.assertTrue(is_valid_php_version_file_version('7.1snapshot'))
        self.assertTrue(is_valid_php_version_file_version('7.0.0snapshot'))
        self.assertTrue(is_valid_php_version_file_version('7.1.0snapshot'))
        self.assertTrue(is_valid_php_version_file_version('7.1.1snapshot'))

[((9, 25, 9, 62), 'PHPUnitKit.plugin.is_valid_php_version_file_version', 'is_valid_php_version_file_version', ({(9, 59, 9, 61): '""""""'}, {}), "('')", False, 'from PHPUnitKit.plugin import is_valid_php_version_file_version\n'), ((10, 25, 10, 63), 'PHPUnitKit.plugin.is_valid_php_version_file_version', 'is_valid_php_version_file_version', ({(10, 59, 10, 62): '""" """'}, {}), "(' ')", False, 'from PHPUnitKit.plugin import is_valid_php_version_file_version\n'), ((11, 25, 11, 68), 'PHPUnitKit.plugin.is_valid_php_version_file_version', 'is_valid_php_version_file_version', ({(11, 59, 11, 67): '"""foobar"""'}, {}), "('foobar')", False, 'from PHPUnitKit.plugin import is_valid_php_version_file_version\n'), ((12, 25, 12, 71), 'PHPUnitKit.plugin.is_valid_php_version_file_version', 'is_valid_php_version_file_version', ({(12, 59, 12, 70): '"""masterfoo"""'}, {}), "('masterfoo')", False, 'from PHPUnitKit.plugin import is_valid_php_version_file_version\n'), ((13, 25, 13, 63), 'PHPUnitKit.plugin.is_valid_php_version_file_version', 'is_valid_php_version_file_version', ({(13, 59, 13, 62): '"""."""'}, {}), "('.')", False, 'from PHPUnitKit.plugin import is_valid_php_version_file_version\n'), ((14, 25, 14, 63), 'PHPUnitKit.plugin.is_valid_php_version_file_version', 'is_valid_php_version_file_version', ({(14, 59, 14, 62): '"""x"""'}, {}), "('x')", False, 'from PHPUnitKit.plugin import is_valid_php_version_file_version\n'), ((15, 25, 15, 65), 'PHPUnitKit.plugin.is_valid_php_version_file_version', 'is_valid_php_version_file_version', ({(15, 59, 15, 64): '"""x.x"""'}, {}), "('x.x')", False, 'from PHPUnitKit.plugin import is_valid_php_version_file_version\n'), ((16, 25, 16, 67), 'PHPUnitKit.plugin.is_valid_php_version_file_version', 'is_valid_php_version_file_version', ({(16, 59, 16, 66): '"""x.x.x"""'}, {}), "('x.x.x')", False, 'from PHPUnitKit.plugin import is_valid_php_version_file_version\n'), ((17, 25, 17, 63), 'PHPUnitKit.plugin.is_valid_php_version_file_version', 'is_valid_php_version_file_version', ({(17, 59, 17, 62): '"""x"""'}, {}), "('x')", False, 'from PHPUnitKit.plugin import is_valid_php_version_file_version\n'), ((18, 25, 18, 70), 'PHPUnitKit.plugin.is_valid_php_version_file_version', 'is_valid_php_version_file_version', ({(18, 59, 18, 69): '"""snapshot"""'}, {}), "('snapshot')", False, 'from PHPUnitKit.plugin import is_valid_php_version_file_version\n'), ((21, 24, 21, 67), 'PHPUnitKit.plugin.is_valid_php_version_file_version', 'is_valid_php_version_file_version', ({(21, 58, 21, 66): '"""master"""'}, {}), "('master')", False, 'from PHPUnitKit.plugin import is_valid_php_version_file_version\n'), ((24, 24, 24, 66), 'PHPUnitKit.plugin.is_valid_php_version_file_version', 'is_valid_php_version_file_version', ({(24, 58, 24, 65): '"""5.0.0"""'}, {}), "('5.0.0')", False, 'from PHPUnitKit.plugin import is_valid_php_version_file_version\n'), ((25, 24, 25, 66), 'PHPUnitKit.plugin.is_valid_php_version_file_version', 'is_valid_php_version_file_version', ({(25, 58, 25, 65): '"""5.0.1"""'}, {}), "('5.0.1')", False, 'from PHPUnitKit.plugin import is_valid_php_version_file_version\n'), ((26, 24, 26, 66), 'PHPUnitKit.plugin.is_valid_php_version_file_version', 'is_valid_php_version_file_version', ({(26, 58, 26, 65): '"""5.0.7"""'}, {}), "('5.0.7')", False, 'from PHPUnitKit.plugin import is_valid_php_version_file_version\n'), ((27, 24, 27, 67), 'PHPUnitKit.plugin.is_valid_php_version_file_version', 'is_valid_php_version_file_version', ({(27, 58, 27, 66): '"""5.0.30"""'}, {}), "('5.0.30')", False, 'from PHPUnitKit.plugin import is_valid_php_version_file_version\n'), ((28, 24, 28, 67), 'PHPUnitKit.plugin.is_valid_php_version_file_version', 'is_valid_php_version_file_version', ({(28, 58, 28, 66): '"""5.0.32"""'}, {}), "('5.0.32')", False, 'from PHPUnitKit.plugin import is_valid_php_version_file_version\n'), ((29, 24, 29, 66), 'PHPUnitKit.plugin.is_valid_php_version_file_version', 'is_valid_php_version_file_version', ({(29, 58, 29, 65): '"""5.1.0"""'}, {}), "('5.1.0')", False, 'from PHPUnitKit.plugin import is_valid_php_version_file_version\n'), ((30, 24, 30, 66), 'PHPUnitKit.plugin.is_valid_php_version_file_version', 'is_valid_php_version_file_version', ({(30, 58, 30, 65): '"""5.1.1"""'}, {}), "('5.1.1')", False, 'from PHPUnitKit.plugin import is_valid_php_version_file_version\n'), ((31, 24, 31, 66), 'PHPUnitKit.plugin.is_valid_php_version_file_version', 'is_valid_php_version_file_version', ({(31, 58, 31, 65): '"""5.1.3"""'}, {}), "('5.1.3')", False, 'from PHPUnitKit.plugin import is_valid_php_version_file_version\n'), ((32, 24, 32, 67), 'PHPUnitKit.plugin.is_valid_php_version_file_version', 'is_valid_php_version_file_version', ({(32, 58, 32, 66): '"""5.1.27"""'}, {}), "('5.1.27')", False, 'from PHPUnitKit.plugin import is_valid_php_version_file_version\n'), ((33, 24, 33, 66), 'PHPUnitKit.plugin.is_valid_php_version_file_version', 'is_valid_php_version_file_version', ({(33, 58, 33, 65): '"""7.0.0"""'}, {}), "('7.0.0')", False, 'from PHPUnitKit.plugin import is_valid_php_version_file_version\n'), ((34, 24, 34, 67), 'PHPUnitKit.plugin.is_valid_php_version_file_version', 'is_valid_php_version_file_version', ({(34, 58, 34, 66): '"""7.1.19"""'}, {}), "('7.1.19')", False, 'from PHPUnitKit.plugin import is_valid_php_version_file_version\n'), ((37, 24, 37, 64), 'PHPUnitKit.plugin.is_valid_php_version_file_version', 'is_valid_php_version_file_version', ({(37, 58, 37, 63): '"""5.6"""'}, {}), "('5.6')", False, 'from PHPUnitKit.plugin import is_valid_php_version_file_version\n'), ((38, 24, 38, 64), 'PHPUnitKit.plugin.is_valid_php_version_file_version', 'is_valid_php_version_file_version', ({(38, 58, 38, 63): '"""7.1"""'}, {}), "('7.1')", False, 'from PHPUnitKit.plugin import is_valid_php_version_file_version\n'), ((39, 24, 39, 64), 'PHPUnitKit.plugin.is_valid_php_version_file_version', 'is_valid_php_version_file_version', ({(39, 58, 39, 63): '"""7.2"""'}, {}), "('7.2')", False, 'from PHPUnitKit.plugin import is_valid_php_version_file_version\n'), ((42, 24, 42, 64), 'PHPUnitKit.plugin.is_valid_php_version_file_version', 'is_valid_php_version_file_version', ({(42, 58, 42, 63): '"""5.x"""'}, {}), "('5.x')", False, 'from PHPUnitKit.plugin import is_valid_php_version_file_version\n'), ((43, 24, 43, 64), 'PHPUnitKit.plugin.is_valid_php_version_file_version', 'is_valid_php_version_file_version', ({(43, 58, 43, 63): '"""6.x"""'}, {}), "('6.x')", False, 'from PHPUnitKit.plugin import is_valid_php_version_file_version\n'), ((44, 24, 44, 64), 'PHPUnitKit.plugin.is_valid_php_version_file_version', 'is_valid_php_version_file_version', ({(44, 58, 44, 63): '"""7.x"""'}, {}), "('7.x')", False, 'from PHPUnitKit.plugin import is_valid_php_version_file_version\n'), ((45, 24, 45, 64), 'PHPUnitKit.plugin.is_valid_php_version_file_version', 'is_valid_php_version_file_version', ({(45, 58, 45, 63): '"""8.x"""'}, {}), "('8.x')", False, 'from PHPUnitKit.plugin import is_valid_php_version_file_version\n'), ((48, 24, 48, 66), 'PHPUnitKit.plugin.is_valid_php_version_file_version', 'is_valid_php_version_file_version', ({(48, 58, 48, 65): '"""7.0.x"""'}, {}), "('7.0.x')", False, 'from PHPUnitKit.plugin import is_valid_php_version_file_version\n'), ((49, 24, 49, 66), 'PHPUnitKit.plugin.is_valid_php_version_file_version', 'is_valid_php_version_file_version', ({(49, 58, 49, 65): '"""7.1.x"""'}, {}), "('7.1.x')", False, 'from PHPUnitKit.plugin import is_valid_php_version_file_version\n'), ((50, 24, 50, 66), 'PHPUnitKit.plugin.is_valid_php_version_file_version', 'is_valid_php_version_file_version', ({(50, 58, 50, 65): '"""7.2.x"""'}, {}), "('7.2.x')", False, 'from PHPUnitKit.plugin import is_valid_php_version_file_version\n'), ((53, 24, 53, 72), 'PHPUnitKit.plugin.is_valid_php_version_file_version', 'is_valid_php_version_file_version', ({(53, 58, 53, 71): '"""5.4snapshot"""'}, {}), "('5.4snapshot')", False, 'from PHPUnitKit.plugin import is_valid_php_version_file_version\n'), ((54, 24, 54, 72), 'PHPUnitKit.plugin.is_valid_php_version_file_version', 'is_valid_php_version_file_version', ({(54, 58, 54, 71): '"""5.5snapshot"""'}, {}), "('5.5snapshot')", False, 'from PHPUnitKit.plugin import is_valid_php_version_file_version\n'), ((55, 24, 55, 72), 'PHPUnitKit.plugin.is_valid_php_version_file_version', 'is_valid_php_version_file_version', ({(55, 58, 55, 71): '"""5.6snapshot"""'}, {}), "('5.6snapshot')", False, 'from PHPUnitKit.plugin import is_valid_php_version_file_version\n'), ((56, 24, 56, 72), 'PHPUnitKit.plugin.is_valid_php_version_file_version', 'is_valid_php_version_file_version', ({(56, 58, 56, 71): '"""7.0snapshot"""'}, {}), "('7.0snapshot')", False, 'from PHPUnitKit.plugin import is_valid_php_version_file_version\n'), ((57, 24, 57, 72), 'PHPUnitKit.plugin.is_valid_php_version_file_version', 'is_valid_php_version_file_version', ({(57, 58, 57, 71): '"""7.1snapshot"""'}, {}), "('7.1snapshot')", False, 'from PHPUnitKit.plugin import is_valid_php_version_file_version\n'), ((58, 24, 58, 74), 'PHPUnitKit.plugin.is_valid_php_version_file_version', 'is_valid_php_version_file_version', ({(58, 58, 58, 73): '"""7.0.0snapshot"""'}, {}), "('7.0.0snapshot')", False, 'from PHPUnitKit.plugin import is_valid_php_version_file_version\n'), ((59, 24, 59, 74), 'PHPUnitKit.plugin.is_valid_php_version_file_version', 'is_valid_php_version_file_version', ({(59, 58, 59, 73): '"""7.1.0snapshot"""'}, {}), "('7.1.0snapshot')", False, 'from PHPUnitKit.plugin import is_valid_php_version_file_version\n'), ((60, 24, 60, 74), 'PHPUnitKit.plugin.is_valid_php_version_file_version', 'is_valid_php_version_file_version', ({(60, 58, 60, 73): '"""7.1.1snapshot"""'}, {}), "('7.1.1snapshot')", False, 'from PHPUnitKit.plugin import is_valid_php_version_file_version\n')]