Am I writing the right kinds of (unit) tests? See below for an example. Thanks!

This page summarizes the projects mentioned and recommended in the original post on /r/PHPhelp

Our great sponsors
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
  • SaaSHub - Software Alternatives and Reviews
  • ZedBot

  • I see thanks. To be honest, how I'm currently using it is that every time I refresh my database during testing I simply have a Populate button on the browser dashboard to call the function and refill the table. Once the whole system is running I probably wouldn't need it any more ,as the currency data would be permanent. Soon I'll start looking through all your other points in your comment above! Thanks

  • slim4-skeleton

    A Slim 4 Skeleton

  • Even just the tests in your first link are very useful to see, such as: https://github.com/odan/slim4-skeleton/blob/master/tests/TestCase/Action/Customer/CustomerCreatorActionTest.php

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

    InfluxDB logo
  • Pest

    Pest is an elegant PHP testing Framework with a focus on simplicity, meticulously designed to bring back the joy of testing in PHP.

  • Here's an example of a set of 25 tests I've written for a class with 4 methods (written using the Pest testing framework):

  • Infection

    PHP Mutation Testing library

  • For your last edit - you can also add infection which will infect your code with other values, like if you expect a positive number, it will try and inject a negative number - and see what happens - does your code break everything or something. Also it will try to inject false where you might expect a true and many many other things, and yes you will get some weird results from infection, but its a good thing to look at, and atleast check the logs and see why the infection failed at a test.

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts