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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T07:31:08+00:00 2026-05-31T07:31:08+00:00

<?php class ProjectTest extends CDbTestCase { public function testCRUD() { $newProject = new Project;

  • 0
 <?php
class ProjectTest extends CDbTestCase
{
    public function testCRUD()
    {
        $newProject = new Project;
        $newProjectName = 'Test Project 1';
        $newProject->setAttribute(
                                array('name'=>$newProjectName,
                                      'description'=>'Test Project Number One',
                                      'create_time'=>'2010-01-01 00:00:00',
                                      'create_user_id'=> 1,
                                      'update_time'=>'2010-01-01 00:00:00',
                                      'update_user_id'=> 1,)
                                );
        $this->assertTrue($newProject->save(false));
    }
}
?>

I have a ar class named Project…in table these are the list of items i have …I m trying to test whether this code inserts the data in to that table or not, using phpunit test in command line but it gives error (Missing argument 2 for CActiveRecord::setAttribute() ) any help

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

    You are using the wrong function (setAttribute) instead of setAttribute*s*. You should use setAttribute*s* if you want to fill the values of a Model object with an array.

    Details here

    setAttribute is used to set a specific value of a model and it takes two parameters, the attribute name and its value

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

Sidebar

Related Questions

class_1.php class class_1 { public function __construct() { require_once $_SERVER['DOCUMENT_ROOT'].'/array.php'; } } class_2.php class
Example class code: <?php class example { public function forExample() { return true; }
My PHP class looks like that. <?php class htmlize { protected $base_dir; public function
i have one php class class veh extends dbClass { function smo($id) { $query=select
I have following php class class User implements IUser { public function __construct($i_objParent =
See the following example (PHP) class Parent { protected $_property; protected $_anotherP; public function
in /lib/Helper.class.php: class Helper { //... some functions static public function createImage( $src_image, $params)
I have a PHP class that stores a complex multidimensional array, and rather than
Is there any way to call a php class (eg. $var = new className)
Consider the following PHP class code class SuperIdea{ . . . static function getById($id){

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.