diff --git a/src/Config.php b/src/Config.php index 474e54e..c387932 100644 --- a/src/Config.php +++ b/src/Config.php @@ -17,6 +17,7 @@ public function getDefaultConfig() return (object) [ 'always_update_all' => 0, 'always_allow_direct_dependencies' => 0, + 'ignore_platform_requirements' => 0, 'allow_list' => [], 'update_dev_dependencies' => 1, 'check_only_direct_dependencies' => 1, @@ -287,6 +288,11 @@ public function getBranchPrefix() return ''; } + public function shouldIgnorePlatformRequirements() : bool + { + return (bool) $this->config->ignore_platform_requirements; + } + public function getCommitMessageConvention() { if (!$this->config->commit_message_convention || !is_string($this->config->commit_message_convention)) { diff --git a/tests/UnitTest.php b/tests/UnitTest.php index ae151c7..248bbaa 100644 --- a/tests/UnitTest.php +++ b/tests/UnitTest.php @@ -68,6 +68,17 @@ public function testAlwaysDirect($filename, $expected_result) self::assertEquals($expected_result, $data->shouldAlwaysAllowDirect()); } + /** + * Test the different things we can set in ignore platform. + * + * @dataProvider getIgnorePlatform + */ + public function testIgnorePlatform($filename, $expected_result) + { + $data = $this->createDataFromFixture($filename); + self::assertEquals($expected_result, $data->shouldIgnorePlatformRequirements()); + } + /** * Test the different things we can set in run scripts, and what we expect from it. * @@ -752,6 +763,36 @@ public function emptyConfigs() ]; } + public function getIgnorePlatform() + { + return [ + [ + 'empty.json', + false, + ], + [ + 'ignore_platform.json', + true + ], + [ + 'ignore_platform2.json', + true + ], + [ + 'ignore_platform3.json', + true + ], + [ + 'ignore_platform4.json', + false + ], + [ + 'ignore_platform5.json', + false + ], + ]; + } + public function getAlwaysAllowDirect() { return [ diff --git a/tests/fixtures/ignore_platform.json b/tests/fixtures/ignore_platform.json new file mode 100644 index 0000000..9aee283 --- /dev/null +++ b/tests/fixtures/ignore_platform.json @@ -0,0 +1,7 @@ +{ + "extra": { + "violinist": { + "ignore_platform_requirements": "yes_of_course_this_should_be_an_int_but_this_evaluates_to_true" + } + } +} diff --git a/tests/fixtures/ignore_platform2.json b/tests/fixtures/ignore_platform2.json new file mode 100644 index 0000000..cf00e26 --- /dev/null +++ b/tests/fixtures/ignore_platform2.json @@ -0,0 +1,7 @@ +{ + "extra": { + "violinist": { + "ignore_platform_requirements": 1 + } + } +} diff --git a/tests/fixtures/ignore_platform3.json b/tests/fixtures/ignore_platform3.json new file mode 100644 index 0000000..2eb2117 --- /dev/null +++ b/tests/fixtures/ignore_platform3.json @@ -0,0 +1,7 @@ +{ + "extra": { + "violinist": { + "ignore_platform_requirements": "1" + } + } +} diff --git a/tests/fixtures/ignore_platform4.json b/tests/fixtures/ignore_platform4.json new file mode 100644 index 0000000..25f604c --- /dev/null +++ b/tests/fixtures/ignore_platform4.json @@ -0,0 +1,7 @@ +{ + "extra": { + "violinist": { + "ignore_platform_requirements": "0" + } + } +} diff --git a/tests/fixtures/ignore_platform5.json b/tests/fixtures/ignore_platform5.json new file mode 100644 index 0000000..a4852ef --- /dev/null +++ b/tests/fixtures/ignore_platform5.json @@ -0,0 +1,7 @@ +{ + "extra": { + "violinist": { + "ignore_platform_requirements": 0 + } + } +}