Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 198113
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T16:54:38+00:00 2026-05-11T16:54:38+00:00

I’m working on a PHP project with solid unit-tests coverage. I’ve noticed, that last

  • 0

I’m working on a PHP project with solid unit-tests coverage.

I’ve noticed, that last time, I’m making very tricky manipulations with unit-tests Command-Line Test Runner’ –filter command.

Here is this command’s explanation from official documentation:

–filter

Only runs tests whose name matches the given pattern. The pattern can be either the name of a single test or a regular expression that matches multiple test names.

I ofter use it because sometimes it becomes very useful to run just a single test suite or test case from the whole test base.

I’m wondering if this is good practice or not?

I have heard that sometimes it is good practice to to run the whole test suite on your Continuous Integration machine, if you know for sure that you have modified only one component and 100% percent confident, that it won’t fail other component’s unit-tests.
What do you think about it?

Some time ago I thought that we shouldn’t care so much about time require to run the whole suite of all unit-tests, but when you have very complicated business logic and unit-tests – this can take significant time.

I understand, that “real” unit-tests shouldn’t interact with DB, use mock/stubs objects, I agree with that. But sometimes, it is much easier(cheaper) to use DB fixtures for the tests.

Please give me some advice, how this problem can be solved?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T16:54:38+00:00Added an answer on May 11, 2026 at 4:54 pm

    Good unit tests should:

    • Have clear methods names and variable names to act as documentation
    • Run fast. This will also be possible
      for test with complicated business
      logic. Test should run in an avarage
      time of something around 0.1 second.
    • Test exactly one thing in one test method
    • Not integrate with external resources like the filesystem, email,
      databases, webservices, and
      everything else. You can create
      seperate database integration tests
      to test your database ineraction.
      These test will slower then your unit
      test most of the time. I put my
      integration tests in a seperate
      project and I run them only when I am
      working on the integration code. I
      also run them on all builds on the CI
      server.
    • Be completely isolated from each other. When you have tests depending
      on each other, you cannot see what
      your problem is from reading which
      tests are failed. You might have to
      debug to find the problem. Isolated
      tests will save you a lot of time.

    Personally, I don’t use category names in my tests. I use 2 test projects per application. One for the unit test and one for the integration tests and slower tests.

    Reaction on:

    “But sometimes, it is much
    easier(cheaper) to use DB fixtures for
    the tests.”

    When your code is written well, it will be easier to mock. I don’t know about mocking frameworks in Php, but I use them in other languages to save me a lot of time. Writing test first and code later might help you to design your code to be testable easier.

    Personally I learned to test better by

    • reading blogs about it
    • reading books about it
    • reading tested code written by others
    • writing a lot of tests of course. It took me a few thousends of tests to become good at it.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 278k
  • Answers 278k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer If myImageView is your outlet, then in code, you can… May 13, 2026 at 3:11 pm
  • Editorial Team
    Editorial Team added an answer You can try the OpenSAML project; it provides a Java… May 13, 2026 at 3:11 pm
  • Editorial Team
    Editorial Team added an answer It is both. The fact that you're running MMC makes… May 13, 2026 at 3:11 pm

Related Questions

I want use html5's new tag to play a wav file (currently only supported
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I've got a string that has curly quotes in it. I'd like to replace
In order to apply a triggered animation to all ToolTip s in my app,

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.