nelmio / alice

Expressive fixtures generator
MIT License
2.5k stars 329 forks source link

MethodCallWithReference is not correctly identified #1133

Open template-provider opened 1 year ago

template-provider commented 1 year ago

I have something like this:

App\Tour:
    tour_{1..10}:
        __construct:
            applicationCountry: 'DE'
            number (unique): 'test-000<current()>'
            date: '<dateTimeBetween("+1 minutes", "+10 minutes")>'
            dcName: 'foo'
            stops: '@stop_collection'

App\Stops:
    stop_collection:
        __construct:
            stops:
             - '@stops_tour_1'

App\Stop:
    stops_{@tour_*}:
        __construct:
            id: '1'
            name: '11111111'
            street: 'blabla'
            city: 'berlin'
            zip: '12345'
            predictedTimeOfArrival: '<dateTimeBetween("+30 minutes", "+600 minutes")>'
            customerNumber: '0987654324'
            deliveryNumber: '0987654322'
            invoiceNumber: '0987654323'
            orders: '@order_collection'

App\Orders:
    order_collection:
        __construct:
            orders: '[@orders]'

App\Order:
    orders:
        __construct:
            orderNumber: '0987654321'
            temperatureRange: 1 

The SimpleFixture has a MethodCallWithReference wit method "stops" + arguments. But it should be a SimpleMethodCall with method "__construct" + arguments.

With this annotation it works:

App\Stops:
    lisel_stop_collection:
        __construct:
            stops: '[@stops_tour_1]'

The problem is the array syntax, but because of this bug: #966 I cannot use this annotation. We want to use something like this: "stops: '[@stopstour<numberBetween(1,10)>]'"