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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T01:37:18+00:00 2026-05-15T01:37:18+00:00

Some of the testing I will need to do will require comparing a known

  • 0

Some of the testing I will need to do will require comparing a known array with the result I am getting from the functions I will be running.

For comparing arrays recursively:

  • Does PHPUnit have an inbuilt function?
  • Does someone here have some code they have constructed to share?
  • Will this be something I will have to construct on my own?
  • 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-15T01:37:18+00:00Added an answer on May 15, 2026 at 1:37 am

    Yes it does. assertEquals() and assertNotEquals() documentation.

    Specifically:

    assertEquals()

    assertEquals(mixed $expected, mixed $actual[, string $message = ''])
    

    Reports an error identified by $message if the two variables $expected and $actual are not equal.

    assertNotEquals() is the inverse of this assertion and takes the same arguments.

    Test Code:

    public function testArraysEqual() {
        $arr1 = array( 'hello' => 'a', 'goodbye' => 'b');
        $arr2 = array( 'hello' => 'a', 'goodbye' => 'b');
    
        $this->assertEquals($arr1, $arr2);
    }
    
    public function testArraysNotEqual() {
        $arr1 = array( 'hello' => 'a', 'goodbye' => 'b');
        $arr2 = array( 'hello' => 'b', 'goodbye' => 'a');
    
        $this->assertNotEquals($arr1, $arr2);
    }
    

    [EDIT]

    Here is the code for out of order aLists:

    public function testArraysEqualReverse() {
        $arr1 = array( 'hello' => 'a', 'goodbye' => 'b');
        $arr2 = array( 'goodbye' => 'b', 'hello' => 'a');
    
        $this->assertEquals($arr1, $arr2);
    }
    

    This test fails:

    public function testArraysOutOfOrderEqual() {
        $arr1 = array( 'a', 'b');
        $arr2 = array( 'b', 'a');
    
        $this->assertEquals($arr1, $arr2);
    }
    

    With message:

    Failed asserting that 
    Array
    (
        [0] => b
        [1] => a
    )
     is equal to 
    Array
    (
        [0] => a
        [1] => b
    )
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am doing some initial testing for a Rails app which will be deployed
Here is some testing code: <script> var movieList = new Array(); var friendList= ;
I picked up a new server to do some testing and need of a
I would like to do some integration testing of a web service from within
I just need some clarification in regards to unit testing with VS2010. Currently, we
I'm doing some testing with nutch and hadoop and I need a massive amount
I need to generate a PDF file with some information i get from a
For some testing code, I'd like to be able to host a WCF service
I am doing some testing on a new html5-css3 framework and I want to
I'm currently doing some testing to determine the performance implications of including an index

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.