Can PHPUnit use assert equals to strictly compare two arrays containing objects?
P粉162773626
P粉162773626 2024-04-05 13:35:37
0
1
1344

I have two arrays of objects. I want to test if these two arrays are equal, but using a strict comparison such as 'false' !== 0.

Is it possible to achieve this in phpunit without requiring custom comparators or other methods?

P粉162773626
P粉162773626

reply all (1)
P粉489081732

Using symfony VarExporter solved the problem:

self::assertSame(VarExporter::export($firstArrayOfObjects), VarExporter::export($secondArrayOfObjects));
    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template
    About us Disclaimer Sitemap
    php.cn:Public welfare online PHP training,Help PHP learners grow quickly!