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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T09:57:24+00:00 2026-06-11T09:57:24+00:00

am trying to write my first test in PHPUnit in Netbeans. I tried to

  • 0

am trying to write my first test in PHPUnit in Netbeans. I tried to follow the example on the Netbeans website http://netbeans.org/kb/docs/php/phpunit.html but I keep getting the error below. I dont have a clue what is happening as I did everything just the way I was instructed on the website.

> PHP Fatal error:  Class 'Calculator' not found in C:\wamp\www\Calculator\tests\CalculatorTest.php on line 18
PHP Stack trace:
PHP   1. {main}() C:\wamp\bin\php\php5.3.8\phpunit:0
PHP   2. PHPUnit_TextUI_Command::main() C:\wamp\bin\php\php5.3.8\phpunit:46
PHP   3. PHPUnit_TextUI_Command->run() C:\wamp\bin\php\php5.3.8\pear\PHPUnit\TextUI\Command.php:130
PHP   4. PHPUnit_TextUI_TestRunner->doRun() C:\wamp\bin\php\php5.3.8\pear\PHPUnit\TextUI\Command.php:192
PHP   5. PHPUnit_Framework_TestSuite->run() C:\wamp\bin\php\php5.3.8\pear\PHPUnit\TextUI\TestRunner.php:325
PHPUnit 3.6.12 by Sebastian Bergmann.
PHP   6. PHPUnit_Framework_TestSuite->run() C:\wamp\bin\php\php5.3.8\pear\PHPUnit\Framework\TestSuite.php:705
PHP   7. PHPUnit_Framework_TestSuite->runTest() C:\wamp\bin\php\php5.3.8\pear\PHPUnit\Framework\TestSuite.php:745
PHP   8. PHPUnit_Framework_TestCase->run() C:\wamp\bin\php\php5.3.8\pear\PHPUnit\Framework\TestSuite.php:772
PHP   9. PHPUnit_Framework_TestResult->run() C:\wamp\bin\php\php5.3.8\pear\PHPUnit\Framework\TestCase.php:751
PHP  10. PHPUnit_Framework_TestCase->runBare() C:\wamp\bin\php\php5.3.8\pear\PHPUnit\Framework\TestResult.php:649
PHP  11. CalculatorTest->setUp() C:\wamp\bin\php\php5.3.8\pear\PHPUnit\Framework\TestCase.php:801

Any help would be appreciated to help me understand what am doing wrong please.

Screen shot
enter image description here

  • 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-11T09:57:25+00:00Added an answer on June 11, 2026 at 9:57 am

    You should make sure that the file containing the class Calculator can be found by the unittest.

    require_once dirname(__FILE__) . '/../Calculator.php';
    

    The test class is placed in a subdirectory, so you need to declare the path relative to the file, containing the unittest. Maybe your application uses autoloading, but your unittest doesn’t know about it.

    If you use Netbeans to create the unittest, the path should already be correct.

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

Sidebar

Related Questions

I'm going crazy trying to write my first php class; it is supposed to
I am trying to write my first test case in perl with the help
I am trying to write my first unit test for one of my service
How do you write first responder unit tests? I'm trying to write a test
I am trying to write some test cases (first time) using jasmine describe(Widget App
I'm currently trying to write some unit test on some javascript files. My first
I'm trying to write 2 simple tests for my website. It's my first time
Just trying to write my first ever WP7 app. I have several hundreds of
I'm trying to write my first simple mvc app. I have a Main View
I'm trying to write my first jquery plugin but I'm running into some difficulties.

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.