[Config] Tests: Allow for list return in configuration access mocking helper

Review Request #1225 — Created Oct. 24, 2024 and updated

b.stoop
Lunr.Config
test/helper
b5654c4...
lunr

Based on release/0.9.x

Tests: Allow for list return in configuration access mocking helper

https://github.com/lunr-php/lunr.config/pull/6

pprkut
  1. 
      
  2. Why?

    1. It is for this issue https://reviews.moveagency.com/r/17746, I can not test the config properly via this method when the return of the config is a list.

    2. The problem here is dat I expect that the config returns a list when I get a key. The code here will create a Mockobject for each item in the list and expects that all the list items are called which gives a problem as I cannot use the list in for example a in_array method. This change should just return a list if that is the value of an key

    3. But that's correct behavior. The Configuration object will never return an array, or a list, unless you specifically call toArray(). Anytime you would try to set an array as a value convert_array_to_class() would turn it into a new instance of a Configuration object.

  3. 
      
Loading...