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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T13:59:16+00:00 2026-06-03T13:59:16+00:00

So I have started to use PHPUnit to test my programs. I have this

  • 0

So I have started to use PHPUnit to test my programs.

I have this problem where I get an error when I try to test a program where the program is gonna control if a webpage exists.

The code:

<?php
class RemoteConnect  
{  
    public function connectToServer($serverName=null)  
    {  
        if($serverName==null){  
          throw new Exception("That's not a server name!");  
        }  
        $fp = fsockopen($serverName,80);  
        return ($fp) ? true : false;  
    }  
    public function returnSampleObject()  
    {  
      return $this;  
    }  
}  
?>

And the test code to it:

<?php  
require_once('RemoteConnect.php');  
class RemoteConnectTest extends PHPUnit_Framework_TestCase  
{  
  public function setUp(){ }  
  public function tearDown(){ }  
  public function testConnectionIsValid()  
  {  
    // test to ensure that the object from an fsockopen is valid  
    $connObj = new RemoteConnect();  
    $serverName = 'www.google.com';  
    $this->assertTrue($connObj->connectToServer($serverName) !== false);  
  }  
}  
?> 

They are in the same directory named: PHPUnit inside the www (C:\wamp\www\PHPUnit)

But I don’t understand why i get the error (Fatal error: Class ‘PHPUnit_Framework_TestCase’ not found in C:\wamp\www\PHPUnit\RemoteConnectTest.php on line 5)

My PHPUnit package path is (C:\wamp\bin\php\php5.3.10\pear\PHPUnit)

I have tried making a program MailSender, where it sends a mail with a text content in it, that was just for using PEAR. And it succeded, but I don’t understand why this doesn’t work.

Regards
Alex

  • 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-03T13:59:17+00:00Added an answer on June 3, 2026 at 1:59 pm

    Don’t you need to have the PHPUnit_Framework_TestCase class available in RemoteConnectTest.php?

    Add the following on top of the file:

    require_once 'PHPUnit/Autoload.php';
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've just started to use linq to sql and have run into a problem
For example I use Netbeans for PHP and have started to integrate PHPUnit &
I have started to use Autofac following this tutorials: http://flexamusements.blogspot.com/2010/09/dependency-injection-part-3-making-our.html Simple class with no
We have started to use spring aop for cross cutting aspects of our application
I have started to use frameworks like Twitter Bootstrap , but if Twitter releases
Question simple and quick: I have started to use Netbeans to write some code
I have just started to use ServiceStack which is an amazing library. However, I
I have started a new mvc project and clicked on project\properties\web - use local
I have started a new web application and have decided to use jquery as
I have recently started looking into Google Charts API for possible use within the

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.