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

  • SEARCH
  • Home
  • 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 3696204
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T04:42:38+00:00 2026-05-19T04:42:38+00:00

When one starts searching for PHP unit tests, one usually stumbles upon: PHPUnit. SimpleTest.

  • 0

When one starts searching for PHP unit tests, one usually stumbles upon:

  1. PHPUnit.
  2. SimpleTest.
  3. A plethora of blogs explaining how to use PHPUnit and SimpleTest.
  4. StackOverflow questions about PHPUnit and SimpleTest…

…and I think you get the idea.

I was wondering: How does one go about unit testing with plain ol’ PHP? Is that even a wise endeavor?

I suppose I would have to build my own little framework. I’m interested because I want to have a better understanding of what’s going on in my unit tests. I’m also interested because I think a lightweight, tailored solution would run my tests faster.

Bonus question: Who’s the underdog? Is there a third framework worth looking into (for acedemic purposes)?

  • 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-19T04:42:39+00:00Added an answer on May 19, 2026 at 4:42 am

    Unit testing is basically a set of assertions.

    Consider the following PHPUnit test case:

    class MyTest extends PHPUnit_Framework_TestCase {
       public function testFoo() {
           $obj = new My;
           $this->assertEquals('bar', $obj->foo());
       }
    }
    

    You can have a similar test case without using PHPUnit:

    class MyTest {
       public function testFoo() {
           $obj = new My;
           assert("$obj->foo() == 'bar'");
       }
    }
    

    However, by doing it without a framework, you will have to manually create an instance of the test case (MyTest) and call each test method manually (MyTest::testFoo, etc.).

    The framework (e.g.: PHPUnit) is nothing more than a set of “helpers” to make it easier and faster: by automatically generating skeleton; with built-in mock objects, command lines scripts, etc.

    You can still unit test without a framework, but in the end, you’ll probably save more time using one, because after all, that’s generally what frameworks are for.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've just completed an installation of SharePoint Foundation 2010 and I can't get searching
I am using Matlab for one of my projects. I am actually stuck at
I've been searching here and Google, but I'm at a loss. I need to
EDIT: Paul has solved this one below. Thanks! I'm trying to resample (upscale) a
I'm developping a Java application . I created this interface with MockupScreens . Please
I have an ATL exe server written with C++ (Visual Studio 2010, with merging
I'd like to apologize in advance, because this is not a very good question.
I have a very typical situation. We have a table called Users which has
I have a SQL Server table and I'm trying to make sense of fulltext
I'm having some problems with hashes in Chrome (and Safari). I'm using the hash

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.