Behapi icon indicating copy to clipboard operation
Behapi copied to clipboard

Debug mode do not works as expected

Open krichprollsch opened this issue 9 years ago • 0 comments

Currently using the debug mode with --api-debug nor @debug does not works as expected. The debug context is loaded via behat.yml

default:                                                                         
  formatters:                                                                    
    progress: true                                                               
  suites:                                                                        
    main:                                                                        
      paths: [%paths.base%/features/specs]                                       
      services: "@behapi.container"                                              
                                                                                 
      contexts:                                                                  
        - Behapi\Context\Rest:                                                   
          - "@http.client"                                                       
          - "@http.stream_factory"                                               
          - "@http.message_factory"                                              
          - "@http.history"                                                      
                                                                                 
        - Behapi\Context\Json:                                                   
          - "@http.history"                                                      
                                                                                 
        - Behapi\Context\DebugRest:                                              
          - "@debug"                                                             
          - "@http.history"                                                      
                                                                                 
  extensions:                                                                    
    Behapi\Extension\Behapi:                                                     
      base_url: 'http://nginx/app_dev.php'  

But the output seems not good:

/srv $  ./vendor/bin/behat features/specs/api/decoder.feature:18 --api-debug 
@rest
Feature: Test data request decoder using a debug endoint
  In order to test the data decoder
  As a api user
  I need to be able to send data

  Scenario: send json data via GET should be ignored        # features/specs/api/decoder.feature:18
    When I create a "GET" request to "/debug/api/echo-data" # Behapi\Context\Rest::createARequest()
    And I set the following body:                           # Behapi\Context\Rest::setTheBody()
      """
       {"foo": "bar"}
      """
    And I send the request                                  # Behapi\Context\Rest::sendRequest()
    Then the status code should be 200                      # Behapi\Context\Rest::statusCodeShouldBe()
    And the response should be a valid json response        # Behapi\Context\Json::responseIsValidjson()
    And in the json, "data.foo" should be equal to "bar"    # Behapi\Context\Json::theJsonPathShouldBeEqualTo()
      PropertyAccessor requires a graph of objects or arrays to operate on, but it found type "NULL" while trying to traverse path "data.foo" at property "foo". (Symfony\Component\PropertyAccess\Exception\UnexpectedTypeException)

--- Failed scenarios:

    features/specs/api/decoder.feature:18

1 scenario (1 failed)
6 steps (5 passed, 1 failed)
0m0.14s (9.17Mb)

krichprollsch avatar Mar 16 '17 16:03 krichprollsch