stable

Clone or download

Read-only

Drop PlannableFeatureIdentifier

part of story #21385 display Program's iterations Expected functional change: when user cannot see a feature and tries to GET its children user stories, the message will change from: "You can not see this feature." to: "Could not find feature with id #123" No other functional change expected when getting the User Stories of a Feature Notes: In order to retrieve the Program Increment backlog, I need to get all the User Stories of all the Features planned in that PI. To do that, I needed to pass a PlannableFeatureIdentifier. PlannableFeatureIdentifier was performing an additional check compared with FeatureIdentifier. But when you have a collection of FeatureIdentifier, that check becomes redundant (see below). Instead, we should move that check in FeatureIdentifier. Only `fromId()` is changed. - `buildCollectionFromProgramIncrement()` does not need to double-check because the SQL query from ContentDao ensures that it returns plannable features - same for `buildCollectionFromProgram()`: the SQL query from FeaturesDao ensures that it returns plannable features - `fromIdAndProgram()` should also do that check. It is used in more "sensitive" parts of the plugin, so I think we should do another contribution for it. Since the REST handler relied on specific exceptions for certain error codes (400 vs 404), the FeatureChecker throws exceptions instead of returning a boolean. Change-Id: I6945dd6d88c109b20188101e00a2b720c8364f88

Modified Files

Name
A plugins/program_management/include/Adapter/Program/Feature/FeatureChecker.php +48 −0 Go to diff View file
R plugins/program_management/include/Domain/Program/Backlog/Feature/Links/FeatureNotAccessException.php Go to diff View file
M plugins/program_management/include/Adapter/Program/Plan/PlanDao.php +12 −1 Go to diff View file
M plugins/program_management/include/Domain/Program/Backlog/Feature/FeatureIdentifier.php +8 −5 Go to diff View file
R plugins/program_management/include/Domain/Program/Backlog/Feature/Content/Links/FeatureIsNotPlannableException.php Go to diff View file
M plugins/program_management/include/Domain/Program/Backlog/Feature/FeatureNotFoundException.php +4 −4 Go to diff View file
M plugins/program_management/include/Domain/Program/Backlog/Feature/Links/UserStoryRetriever.php +14 −29 Go to diff View file
D plugins/program_management/include/Domain/Program/Backlog/Feature/PlannableFeatureIdentifier.php +0 −62 Go to diff View file
M plugins/program_management/include/Domain/Program/Backlog/UserStory/UserStoryIdentifier.php +2 −2 Go to diff View file
A plugins/program_management/include/Domain/Program/Feature/CheckIsValidFeature.php +34 −0 Go to diff View file
M plugins/program_management/include/REST/v1/ProgramBacklogItemsResource.php +6 −7 Go to diff View file
M plugins/program_management/site-content/fr_FR/LC_MESSAGES/tuleap-program_management.po +0 −3 Go to diff View file
A plugins/program_management/tests/unit/Adapter/Program/Feature/FeatureCheckerTest.php +91 −0 Go to diff View file
M plugins/program_management/tests/unit/Builder/FeatureIdentifierBuilder.php +3 −5 Go to diff View file
D plugins/program_management/tests/unit/Builder/PlannableFeatureBuilder.php +0 −51 Go to diff View file
M plugins/program_management/tests/unit/Builder/UserStoryIdentifierBuilder.php +1 −1 Go to diff View file
M plugins/program_management/tests/unit/Domain/Program/Backlog/Feature/FeatureIdentifierTest.php +11 −15 Go to diff View file
M plugins/program_management/tests/unit/Domain/Program/Backlog/Feature/Links/UserStoryRetrieverTest.php +6 −8 Go to diff View file
D plugins/program_management/tests/unit/Domain/Program/Backlog/Feature/PlannableFeatureIdentifierTest.php +0 −60 Go to diff View file
M plugins/program_management/tests/unit/Domain/Program/Backlog/UserStory/UserStoryIdentifierTest.php +4 −5 Go to diff View file
A plugins/program_management/tests/unit/Stub/CheckIsValidFeatureStub.php +60 −0 Go to diff View file
A plugins/program_management/tests/unit/Stub/VerifyIsFeatureStub.php +47 −0 Go to diff View file