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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T07:32:59+00:00 2026-05-30T07:32:59+00:00

I wrote a little test case for a model I created in Yii and

  • 0

I wrote a little test case for a model I created in Yii and when I try to run the test, it gives me: Fatal error: Class

'.....\ActiveRecord' not found in Commissions.php'

Now, my class (commissions.php) inherits the ActiveRecord class in Yii but how can I tell PHPunit where to find it? I’ve tried using an include statement in Commissions.php but then it can’t find the class that ActiveRecord inherits and so on.

<?php

include_once('Commissions.php');

class CommissionsTest extends PHPUnit_Framework_TestCase
{
    // Here, the idea would be to check one or two employees manually or based on the SQL query
    // Or even a previous value using the function so that when any changes are made, the value
    // remains the same while using the same arguments.
    public function setUp()
    {
        $this->employee = new Commissions();
        $this->employee->employeeId = 'V1S';
        $this->employee->year = 2012;
        $this->employee->period = 1;
    }

    public function testAttributes()
    {
        $this->assertEquals('V1S', $this->employee->employeeId);
        $this->assertEquals(2012, $this->employee->year);
        $this->assertEquals(1, $this->employee->period);
    }
}

?>
  • 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-30T07:33:00+00:00Added an answer on May 30, 2026 at 7:33 am

    What you should have at the beginning of your testcase is:

    Yii:import('application.models.Commissions'); //or whatever your model is called
    class CommissionsTest extends CDbTestCase { //Not PHPUnit_Framework_TestCase
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I wrote this little test class, based upon a Python issue - closed/fixed ,
I wrote a little test program but I'm experiencing a syntax error in my
i wrote a little test programm which queries the status servlet of a tomcat
I'm learning the relative layout and wrote a little test layout to simulate a
I wrote a little piece of code to expose my problem. public class date
I wrote a little program that use activemq embedded broker. Program run on one
I'm trying to write a test case for Selenium and I'm having a little
I wrote a little test program to show here. Here is the source code.
I wrote a little test to check for null pointer, I simplified it with
I wrote a little PHP script below to demonstrate my question. Run the code

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.