liip / liip/LiipFunctionalTestBundle

Refactor the bundle to be more stable and faster

Open
#332 22 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

RFC
Dominant language
PHP
Stars
648
Forks
179
PR merge metrics
No merged PRs in 30d

Description

Hi @alexislefebvre and @lsmith77 , how are you?

Excuse me for my long absence, but I were in the process of closing the first version of my app and I had to concentrate on it.

But now that it is online, I'd like to start again contributing here.

We leave ourselves speaking about the fastness of this bundle (#218).

Then the the discourse was left to itself.

I'm opening this issue to try to make a recap of what we said and to draft a first (small) plan (so I can afford it given the time I have to dedicate to LiipFunctionTestBundle).

So, here are the things I think are priorities to create a better and faster bundle:

  • Fix #323: Move library files to src and tests files to tests;
  • Ordering methods following this order: public, protected and private (this will make for developer easier to understand the API (s)he can use;
  • Split the big WebTestCase.php in smaller files: AbstractTestCase from which inherit WebTestCase and CommandTestCase. This will make us able to move to dedicated files methods that are relevant only for one kind of test (for example, getVerbosityLevel() that is relevant only for commands or see also #329 )
  • Fix #218: Start using properties (also not private to not BC) to store objects created by the bundle: this makes us able to do the next task...
  • Start using setUp() and tearDown() methods to unset properties to free up memory during execution and make tests faster
  • Start using getters and setter, deprecating the usage of direct access to properties (that should be private: extending classes should use getters and setters)
  • Improve fetchContent() and fetchCrawler(): they MUST set (or use the already created - for this reason is useful using getters and setters: we can check if a client already exists and avoid creating a new one) the $client property, and not creating each time the client. There are use cases (mostly after a form is submitted) where it is required to reuse the same exact client created to load some subsequent pages: in those cases it is impossible to use the same $client and the only option is to create it directly in the test method using makeClient(), forcing the developer to write more code.
  • Maybe also using PHPCSFixer is a good thing...

All this will be a good preparation also for the #6 , making easier the transition process.

This is a first list: what do you think about it?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading WebTestCase.php and the discussions in #218 and #329, then review the unchecked refactoring items in this issue. The work is only done once a specific scope is agreed and the selected changes—such as splitting test cases, reusing the client, or adding lifecycle cleanup—are completed.

Written by the indexing model from the issue text.

Assessment

Tech stack
php, symfony
Domain
testing
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.