Uploaded image for project: 'eZ Publish / Platform'
  1. eZ Publish / Platform
  2. EZP-23285

As QA I want Guzzle4 returning the correct status code

    XMLWordPrintable

Details

    Description

      Testing REST server with several different clients only Guzzle (v3 and v4) give a different result.

      When attempting to delete a ContentTypeGroup that doesn't exist should return 404 - If the content type does not exist which only Guzzle is returning a 200 OK (from the tested clients)

      Firefox RESTClient addon

          Status Code:        404 Not Found
          Cache-Control:      private
          Connection:         Keep-Alive
          Content-Type:       application/vnd.ez.api.ErrorMessage+xml
          Date:               Tue, 26 Aug 2014 10:44:37 GMT
          Keep-Alive:         timeout=5, max=100
          Server:             Apache/2.2.22 (Debian)
          Transfer-Encoding:  chunked
          X-Powered-By:       PHP/5.4.4-14+deb7u12
      

      Buzz

        Scenario: Get a informative error when deleting a non existent Content Type Group # vendor/ezsystems/ezpublish-kernel/eZ/Bundle/EzPublishRestBundle/Features/ContentTypeGroup/delete.feature:13
          Given I have "administrator" permissions                                        # eZ\Bundle\EzPublishRestBundle\Features\Context\SubContext\Authentication::iAmLoggedInAsAn()
          And there isn't a Content Type Group with id "{id}"                             # EzSystems\BehatBundle\ObjectContext\ContentTypeGroup::iDontHaveContentTypeGroupWithId()
          When I send a "DELETE" request to "/content/typegroups/{id}"                    # eZ\Bundle\EzPublishRestBundle\Features\Context\RestContext::iCreateAndSendRequest()
          Then I see a not found exception                                                # eZ\Bundle\EzPublishRestBundle\Features\Context\SubContext\Exception::iSeeNotFoundError()
      
      1 scenario (1 passed)
      4 steps (4 passed)
      

      Guzzle 3 and Guzzle 4:

        Scenario: Get a informative error when deleting a non existent Content Type Group # vendor/ezsystems/ezpublish-kernel/eZ/Bundle/EzPublishRestBundle/Features/ContentTypeGroup/delete.feature:13
          Given I have "administrator" permissions                                        # eZ\Bundle\EzPublishRestBundle\Features\Context\SubContext\Authentication::iAmLoggedInAsAn()
          And there isn't a Content Type Group with id "{id}"                             # EzSystems\BehatBundle\ObjectContext\ContentTypeGroup::iDontHaveContentTypeGroupWithId()
          When I send a "DELETE" request to "/content/typegroups/{id}"                    # eZ\Bundle\EzPublishRestBundle\Features\Context\RestContext::iCreateAndSendRequest()
          Then I see a not found exception                                                # eZ\Bundle\EzPublishRestBundle\Features\Context\SubContext\Exception::iSeeNotFoundError()
            Expected status code '404' found '200'
            Failed asserting that '200' matches expected '404'.
      
      1 scenario (1 failed)
      4 steps (3 passed, 1 failed)
      

      Guzzle4 request print_r

      GuzzleHttp\Message\Request Object
      (
          [url:GuzzleHttp\Message\Request:private] => GuzzleHttp\Url Object
              (
                  [scheme:GuzzleHttp\Url:private] => http
                  [host:GuzzleHttp\Url:private] => behat.deb
                  [port:GuzzleHttp\Url:private] => 
                  [username:GuzzleHttp\Url:private] => 
                  [password:GuzzleHttp\Url:private] => 
                  [path:GuzzleHttp\Url:private] => /api/ezp/v2/content/typegroups/351
                  [fragment:GuzzleHttp\Url:private] => 
                  [query:GuzzleHttp\Url:private] => GuzzleHttp\Query Object
                      (
                          [encoding:GuzzleHttp\Query:private] => RFC3986
                          [aggregator:GuzzleHttp\Query:private] => 
                          [data:protected] => Array
                              (
                              )
      
                      )
      
              )
      
          [method:GuzzleHttp\Message\Request:private] => DELETE
          [transferOptions:GuzzleHttp\Message\Request:private] => GuzzleHttp\Collection Object
              (
                  [data:protected] => Array
                      (
                          [redirect] => Array
                              (
                                  [max] => 5
                                  [strict] => 
                                  [referer] => 
                              )
      
                          [decode_content] => 1
                          [verify] => /var/www/html/behat/vendor/guzzlehttp/guzzle/src/cacert.pem
                      )
      
              )
      
          [headers:GuzzleHttp\Message\AbstractMessage:private] => Array
              (
                  [host] => Array
                      (
                          [0] => behat.deb
                      )
      
                  [user-agent] => Array
                      (
                          [0] => Guzzle/4.2.1 curl/7.26.0 PHP/5.4.4-14+deb7u12
                      )
      
                  [authorization] => Array
                      (
                          [0] => Basic YWRtaW46cHVibGlzaA==
                      )
      
              )
      
          [headerNames:GuzzleHttp\Message\AbstractMessage:private] => Array
              (
                  [host] => Host
                  [user-agent] => User-Agent
                  [authorization] => Authorization
              )
      
          [body:GuzzleHttp\Message\AbstractMessage:private] => 
          [protocolVersion:GuzzleHttp\Message\AbstractMessage:private] => 1.1
          [emitter:GuzzleHttp\Message\Request:private] => GuzzleHttp\Event\Emitter Object
              (
                  [listeners:GuzzleHttp\Event\Emitter:private] => Array
                      (
                          [before] => Array
                              (
                                  [-100] => Array
                                      (
                                          [0] => Array
                                              (
                                                  [0] => GuzzleHttp\Subscriber\Prepare Object
                                                      (
                                                      )
      
                                                  [1] => onBefore
                                              )
      
                                      )
      
                              )
      
                          [complete] => Array
                              (
                                  [200] => Array
                                      (
                                          [0] => Array
                                              (
                                                  [0] => GuzzleHttp\Subscriber\Redirect Object
                                                      (
                                                      )
      
                                                  [1] => onComplete
                                              )
      
                                      )
      
                                  [100] => Array
                                      (
                                          [0] => Array
                                              (
                                                  [0] => GuzzleHttp\Subscriber\HttpError Object
                                                      (
                                                      )
      
                                                  [1] => onComplete
                                              )
      
                                      )
      
                              )
      
                      )
      
                  [sorted:GuzzleHttp\Event\Emitter:private] => Array
                      (
                          [before] => Array
                              (
                                  [0] => Array
                                      (
                                          [0] => GuzzleHttp\Subscriber\Prepare Object
                                              (
                                              )
      
                                          [1] => onBefore
                                      )
      
                              )
      
                          [complete] => Array
                              (
                                  [0] => Array
                                      (
                                          [0] => GuzzleHttp\Subscriber\Redirect Object
                                              (
                                              )
      
                                          [1] => onComplete
                                      )
      
                                  [1] => Array
                                      (
                                          [0] => GuzzleHttp\Subscriber\HttpError Object
                                              (
                                              )
      
                                          [1] => onComplete
                                      )
      
                              )
      
                      )
      
              )
      
      )
      

      Guzzle4 response print_r

      GuzzleHttp\Message\Response Object
      (
          [reasonPhrase:GuzzleHttp\Message\Response:private] => OK
          [statusCode:GuzzleHttp\Message\Response:private] => 200
          [effectiveUrl:GuzzleHttp\Message\Response:private] => http://behat.deb/api/ezp/v2/content/typegroups/351
          [headers:GuzzleHttp\Message\AbstractMessage:private] => Array
              (
                  [date] => Array
                      (
                          [0] => Tue, 26 Aug 2014 10:50:09 GMT
                      )
      
                  [server] => Array
                      (
                          [0] => Apache/2.2.22 (Debian)
                      )
      
                  [x-powered-by] => Array
                      (
                          [0] => PHP/5.4.4-14+deb7u12
                      )
      
                  [vary] => Array
                      (
                          [0] => Accept-Encoding
                      )
      
                  [content-length] => Array
                      (
                          [0] => 5334
                      )
      
                  [content-type] => Array
                      (
                          [0] => text/html
                      )
      
              )
      
          [headerNames:GuzzleHttp\Message\AbstractMessage:private] => Array
              (
                  [date] => Date
                  [server] => Server
                  [x-powered-by] => X-Powered-By
                  [vary] => Vary
                  [content-length] => Content-Length
                  [content-type] => Content-Type
              )
      
          [body:GuzzleHttp\Message\AbstractMessage:private] => GuzzleHttp\Stream\Stream Object
              (
                  [stream:GuzzleHttp\Stream\Stream:private] => Resource id #809
                  [size:GuzzleHttp\Stream\Stream:private] => 
                  [seekable:GuzzleHttp\Stream\Stream:private] => 1
                  [readable:GuzzleHttp\Stream\Stream:private] => 1
                  [writable:GuzzleHttp\Stream\Stream:private] => 1
                  [uri:GuzzleHttp\Stream\Stream:private] => php://temp
              )
      
          [protocolVersion:GuzzleHttp\Message\AbstractMessage:private] => 1.1
      )
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            marcos.loureiro-obsolete@ez.no Marcos Loureiro (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: