dusk: [6.x] assertVue and assertVueIsNot do not accept arrays

  • Dusk Version: 6.10.0
  • Laravel Version: 8.19.0
  • PHP Version: 8.0.0
  • Database Driver & Version: N/A

Description:

The methods assertVue and assertVueIsNot do not work with arrays due to the error message dumping the supplied $value into a string. This causes an array to string conversion error.

PHPUnit::assertEquals(
    $value,
    $this->vueAttribute($componentSelector, $key),
    "Did not see expected value [{$value}] at the key [{$key}]."
);

A simple check needs to be added to see whether the provided value can be converted to a string. If not, then maybe it should not be included at all. Instead perhaps simply say:

"Did not see expected value at the key [{$key}]."

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 18 (11 by maintainers)

Most upvoted comments

This isn’t true. They don’t accept an array atm if you look at their DocBlocks.

My apologies. You are correct.

I don’t think using mixed is a good solution. Why don’t you just use assertVue a few times after each other for the values that you’re trying to check?

I’m not sure how to do that given that I’m trying to compare two arrays and not an array containing an array. In any event, I just decided to create a macro with the desired functionality.

Thanks for the discussion though 👍