stable

Clone or download

Read-only

Refactor BaselineControllerTest

Part of epic #12142 Baseline v1 Multiplement improvements here in order to make BaselineControllerTest readable and maitainable. - Isolate Baseline code base from legacy from with adapters - Create stubs for adapters (thanks to some interfaces which make maintainability easier) to make tests more readable and maitainable than with mocks - Improve code coverage with an integration test - Test dependency injection thanks to DependenciesContext - Hide mock boilerplate (and improve tests readability) with builders for Changeset and Milestone - Remove duplications in tests with factories - Move domain logics (like permissions) from REST to Baseline - Rename SecurityContext to CurrentUserProvider as this class is only reponsible for current user for now Change-Id: Ibd554f2f8a10c2dc9cb2fb7df5814a1299dbfd2d

Modified Files

Name
M composer.json +2 −1 Go to diff View file
A include/Adapter/ChangesetRepositoryImpl.php +47 −0 Go to diff View file
R include/Adapter/SecurityContextImpl.php Go to diff View file
R include/REST/FieldRepository.php Go to diff View file
R phpunit/Baseline/ClockTest.php Go to diff View file
D include/Baseline/Baseline.php +0 −69 Go to diff View file
D include/Baseline/BaselineRepository.php +0 −54 Go to diff View file
M include/Baseline/BaselineService.php +72 −19 Go to diff View file
A include/Baseline/ChangesetRepository.php +31 −0 Go to diff View file
R include/Baseline/SecurityContext.php Go to diff View file
A include/Baseline/FieldRepository.php +35 −0 Go to diff View file
R include/Baseline/Clock.php Go to diff View file
A include/Baseline/Permissions.php +33 −0 Go to diff View file
R include/Baseline/ArtifactPermissions.php Go to diff View file
A include/Baseline/SimplifiedBaseline.php +82 −0 Go to diff View file
R include/Baseline/TransientBaseline.php Go to diff View file
A include/REST/BaselineController.php +152 −0 Go to diff View file
D include/REST/BaselinesController.php +0 −202 Go to diff View file
M include/REST/BaselinesResource.php +12 −19 Go to diff View file
A include/Support/DependenciesContext.php +264 −0 Go to diff View file
D phpunit/Baseline/ArtifactPermissionsTest.php +0 −124 Go to diff View file
M phpunit/Baseline/BaselineServiceTest.php +72 −64 Go to diff View file
A phpunit/Baseline/PermissionsImplTest.php +138 −0 Go to diff View file
A phpunit/Factory/ChangesetBuilder.php +90 −0 Go to diff View file
A phpunit/Factory/ChangesetFactory.php +33 −0 Go to diff View file
A phpunit/Factory/DateTimeFactory.php +32 −0 Go to diff View file
A phpunit/Factory/MilestoneBuilder.php +67 −0 Go to diff View file
A phpunit/Factory/MilestoneFactory.php +33 −0 Go to diff View file
A phpunit/REST/BaselineControllerIntTest.php +198 −0 Go to diff View file
D phpunit/REST/BaselinesControllerTest.php +0 −261 Go to diff View file
A phpunit/Stub/ChangesetRepositoryStub.php +52 −0 Go to diff View file
A phpunit/Stub/CurrentUserProviderStub.php +49 −0 Go to diff View file
A phpunit/Stub/FieldRepositoryStub.php +72 −0 Go to diff View file
A phpunit/Stub/MilestoneRepositoryStub.php +58 −0 Go to diff View file
A phpunit/Stub/PermissionsStub.php +55 −0 Go to diff View file
M phpunit/bootstrap.php +7 −0 Go to diff View file
M site-content/fr_FR/LC_MESSAGES/tuleap-baseline.po +18 −5 Go to diff View file
M site-content/tuleap-baseline.pot +16 −3 Go to diff View file
M tests/rest/BaselinesResourceTest.php +3 −3 Go to diff View file