This repository was archived by the owner on Apr 3, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Feat/test setup #43
Draft
TeddyRoncin
wants to merge
37
commits into
dev
Choose a base branch
from
feat/test-setup
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Feat/test setup #43
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Added many filters for the /users routes. User's nickname are now returned when fetching a collection of users
…e current version Some code (in the filters) was outdated and not updated during the rebase
…breaking changes were fixed Most notable changes are the change of the version of Symfony, ApiPlatform and PHP
…ions of libraries
groups is a keyword in mysql, so I replaced the table name in the code (App\Entity\Group) by `groups`. Using `...` tells mysql that the content has to be evaluated, and is not a keyword
Started to implement application tests on routes asso/* and user/*
testing content of json
Made 1 class per route. GET users/ is now more tested to verify it responds normally when something is not expected (not connected, parameter out of range, ...)
reafactoring tests structure. We now call directly routes, instead of calling a URL. Tests are now disconnected to each other
Improved GetUsers tests to make them test everything. I can't see any more major issue with this class. Now uses database calls to test API calls. Also created superclass EtuUTTApiTestCase, which should provide a lot of useful methods in the future
Class EtuUTTApiTestCase now saves the 'test' user, created in the setUp method. Directory tests/users was renamed to tests/Users, to be more coherent with conventions used in the project
Added createUser method. The methods takes 4 parameters : $firstName, $lastName, $login and $role. Role is not mendatory. If not provided, it is defaulted to 'ROLE_USER'. It creates a user according to the parameters, put it in the database, and flush the data. In the future, if necessary, it could be useful to add a parameter to ask if we want to flush the database, because it could maybe be slow if we need to do that a lot.
testing normal call, when not connected, when the user does not exist, when no body is provided, sql injections and invalid field contents
testing normal calls, when user doesn't have the permissions, when the user is not connected, when the user does not exist and verified sql injections
changed version of dependency symfony/http-foundation. It's now possible to set a maximum/minimum of visible groups while seeding the Group table. lint. changed security of PATCH /groups/{slug}. Translations where not present in the group:read:one group. changed the group admin voter. Added utility functions to EtuUTTApiTestCase. updated a few tests on /users routes
…hanges made to it it is now possible to call the backupDatabase method from the EtuUTTApiTestCase class to make a backup, and then call the assertDatabaseSameExcept method to assert the new database and the old one are the same. Expected differences can be specified in the arguments of the function
Added tests for each function of the route. Removed some prints. Added assertSameUserReadSome method in EtuUTTApiTestCase. Added order in the /users routes. Fixed a problem with skip_null_values (it now seems like it's necessary to explicit that parameter for each route that overrides normalizationContext). Added a way to generate a custom amount of users in the UserSeeder. Changed phone number generation in UserInfoVisibilitySeeder. Added a parameter in BrancheFiliereFormationSeeder to set the minimum amount of users with filiere that should be generated
…alid parameter values Added a test to test the parameter name. Added some tests to verify API responds correctly when an invalid value is passed to the parameters. Updated the testUEParameter test. Added parameter $flush to EtuUTTApiTestCase::createUser (defaults to false) to avoid the changes to be sent to the database (the new entity is still persisted)
SearchInNamesFilter and UEFilter both contained a SQL injection flaw. It has been fixed
UserDataVisibilityItemDataProvider was crashing when trying to provide data to a non-authenticated user. PATCH /users/{id} didn't have the skip_null_values parameter set to false. On creation, UserInfos::$birthday was not set to a round day (it was set to the current time, not the current day)
Documented new folders in the tests/ folder in the README file. Documented class EtuUTTApiTestCase (and its methods). Documented test classes
Co-authored-by: Thomas Ritaine <[email protected]>
…y fakerphp/faker (#38)
…e current version Some code (in the filters) was outdated and not updated during the rebase
…breaking changes were fixed Most notable changes are the change of the version of Symfony, ApiPlatform and PHP
…ange in UserDataVisibilityItemDataProvider
…t passed to the voter
…oter was not applied here
…TTApiTestCase to create a new client
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR is the first part of the split of PR #37
It introduces the base test class (
EtuUTTApiTestCase
)Checklist
Test
Implementation
dd()
|dump()
Tools
src
folder.Documentation
README.md
file.