diff --git a/src/Config.php b/src/Config.php index c735a01..a9cc9eb 100644 --- a/src/Config.php +++ b/src/Config.php @@ -63,6 +63,11 @@ public function setConfig($config) } } + public function shouldUpdateWithDependencies() + { + return (bool) $this->config->update_with_dependencies; + } + public function shouldAllowUpdatesBeyondConstraint() { return (bool) $this->config->allow_updates_beyond_constraint; diff --git a/tests/UnitTest.php b/tests/UnitTest.php index f7deafc..cbf871a 100644 --- a/tests/UnitTest.php +++ b/tests/UnitTest.php @@ -125,6 +125,17 @@ public function testOnePrPerPackage($filename, $expected_result) self::assertEquals($expected_result, $data->shouldUseOneMergeRequestPerPackage()); } + /** + * Test the update_with_dependencies option. + * + * @dataProvider getUpdateWithDeps + */ + public function testUpdateWithDeps($filename, $expected_result) + { + $data = $this->createDataFromFixture($filename); + self::assertEquals($expected_result, $data->shouldUpdateWithDependencies()); + } + /** * Test the allow_updates_beyond_constraint option. * @@ -175,6 +186,32 @@ protected function createDataFromFixture($filename) return Config::createFromComposerData($file_contents); } + public function getUpdateWithDeps() + { + return [ + [ + 'empty.json', + true, + ], + [ + 'update_with_dependencies.json', + true, + ], + [ + 'update_with_dependencies2.json', + false, + ], + [ + 'update_with_dependencies3.json', + true, + ], + [ + 'update_with_dependencies4.json', + false, + ], + ]; + } + public function getUpdatesBeyondConstraint() { return [ diff --git a/tests/fixtures/update_with_dependencies.json b/tests/fixtures/update_with_dependencies.json new file mode 100644 index 0000000..51e47ab --- /dev/null +++ b/tests/fixtures/update_with_dependencies.json @@ -0,0 +1,7 @@ +{ + "extra": { + "violinist": { + "update_with_dependencies": 1 + } + } +} diff --git a/tests/fixtures/update_with_dependencies2.json b/tests/fixtures/update_with_dependencies2.json new file mode 100644 index 0000000..5209a9d --- /dev/null +++ b/tests/fixtures/update_with_dependencies2.json @@ -0,0 +1,7 @@ +{ + "extra": { + "violinist": { + "update_with_dependencies": 0 + } + } +} diff --git a/tests/fixtures/update_with_dependencies3.json b/tests/fixtures/update_with_dependencies3.json new file mode 100644 index 0000000..9afd573 --- /dev/null +++ b/tests/fixtures/update_with_dependencies3.json @@ -0,0 +1,7 @@ +{ + "extra": { + "violinist": { + "update_with_dependencies": "1" + } + } +} diff --git a/tests/fixtures/update_with_dependencies4.json b/tests/fixtures/update_with_dependencies4.json new file mode 100644 index 0000000..f61def1 --- /dev/null +++ b/tests/fixtures/update_with_dependencies4.json @@ -0,0 +1,7 @@ +{ + "extra": { + "violinist": { + "update_with_dependencies": "0" + } + } +}