Skip to content
This repository has been archived by the owner on Apr 20, 2021. It is now read-only.

An uploaded file must be an array or an instance of UploadedFile issue #210

Open
antonioperic opened this issue Jun 7, 2017 · 1 comment

Comments

@antonioperic
Copy link

I am trying this test on Symfony app

Scenario: As logged User I cannot get attachment other users uploaded
   Given I send a POST request to "/rest/index.php" with parameters:
     | key     | value      |
     | foo     | bar        |
     | foofile | @dummy_img.png |
   And I add "Content-Type" header equal to "application/x-www-form-urlencoded"
   Then I should see "You have sent a POST request. "
   And I should see "1 parameter(s)"
   And I should see "1 file(s)"
   And I should see "foo : bar"
   And I should see "foofile - name : lorem.txt"
   And I should see "foofile - error : 0"
   And I should see "foofile - size : 39"

The problem I am getting is:

An uploaded file must be an array or an instance of UploadedFile. (InvalidArgumentException)

This is my behat config:

default:
  calls:
    error_reporting: 16383 # E_ALL & ~E_USER_DREPRECATED
  suites:
    default:
      contexts:
        - FeatureContext: { doctrine: "@doctrine" }
        - Behat\MinkExtension\Context\MinkContext
        - Sanpi\Behatch\Context\RestContext
        - JsonContext
        - MessageAttachmentContext
        - Fidry\AliceBundleExtension\Context\Doctrine\AliceORMContext
        - UserBundle\Behat\Context\UserContext
        - GatheringBundle\Behat\Context\GatheringContext
  extensions:
    Behat\Symfony2Extension:
      kernel:
        env: "test"
        debug: "true"
    Behat\MinkExtension:
      base_url: "http://example.com/"
      files_path: "%paths.base%/features/dummy/"
      sessions:
        default:
          symfony2: ~
    Sanpi\Behatch\Extension: ~
    Fidry\AliceBundleExtension\Extension:
      fixtures_base_path: ~ # default to %paths.base%/features/fixtures

Do I need to include some other context to get this working. key value is sent in files but for some reasons symfony cannot build that in ParatmerBag

@sanpii
Copy link
Member

sanpii commented Jun 8, 2017

Which version of behatch/contexts do you use?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants