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 8801571
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T00:52:11+00:00 2026-06-14T00:52:11+00:00

class TestCase { public function multiply($a,$b) { return $a*$b; } } I need to

  • 0
class TestCase
{
    public function multiply($a,$b)
    {
        return $a*$b;
    }
}

I need to use test cases in PHP. Some websites suggests that to use TDD in PHP, we need to install PHPUnit. For now, I need only knowledge of test cases and using them in PHP to test a program. Is that possible for above PHP code(without installing PHPUnit)?
I have WAMPP to run php.

  • 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-06-14T00:52:12+00:00Added an answer on June 14, 2026 at 12:52 am

    Read this article written by authors of PHPUnit: http://www.phpunit.de/manual/current/en/automating-tests.html

    One of the examples from there:

    For a newly created array we expect the count() function to return 0. After we add an element, count() should return 1

    <?php
        $fixture = array();
        assertTrue(count($fixture) == 0);
    
        $fixture[] = 'element';
        assertTrue(count($fixture) == 1);
    
        function assertTrue($condition)
        {
            if (!$condition) {
                throw new Exception('Assertion failed.');
            }
        }
    ?>
    

    You can reinvent the wheel, but why do you need it?

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

Sidebar

Related Questions

I have the following test case: include_once('../Logger.php'); class LoggerTest extends PHPUnit_Framework_TestCase { public function
I need to test some function, that needs my application's database and context. I
junit.framework.AssertionFailedError: Class com.android.deviceintelligence.test.Testshutdown has no public constructor TestCase(String name) or TestCase() at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:169) at
How can it be that this test case import unittest class PropTest(unittest.TestCase): def test(self):
// src/Acme/DemoBundle/Tests/Controller/DemoControllerTest.php namespace Acme\DemoBundle\Tests\Controller; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; class DemoControllerTest extends WebTestCase { public function testIndex()
I'm just learning unit testing. This php code class Foo { public function bar($arg)
For unittest class SampleTest extends PHPUnit_Framework_TestCase { public function testBreakpoint() { $a = 18;
I am using List in C#. Code is as mentioned below: TestCase.cs public class
I have 2 files: xxxxxTest.java [ refer this ] public class xxxxxTest extends TestCase
I have the following test case: @ContextConfiguration(/spring/test-context.xml) @TransactionConfiguration(transactionManager=txManager) @Transactional() public class MyEntityDaoTestCase extends AbstractJUnit4SpringContextTests

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.