You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Rest] Test fails with error when endpoint responds with 403 - The annotation "@part" in method Codeception\Module\REST::haveHttpHeader() was never imported
#6695
Open
xavier-sanna opened this issue
Sep 28, 2023
· 3 comments
On an api platform project, I am trying to perform a simple endpoint security test.
Some of the scenarios should return a forbidden 403 response.
And I should assert the code is 403.
Tests pass. yay!
What do you get instead?
When trying manually with postman, I get the proper response payload, headers, and status code
However inside my codeception test, I just get a very strange error (which then prevents the test to go further)
[Doctrine\Common\Annotations\AnnotationException] [Semantical Error] The annotation "@part" in method Codeception\Module\REST::haveHttpHeader() was never imported. Did you maybe forget to add a "use" statement for this annotation?
Here is the full verbose CLI output
docker compose exec core_php sh -c 'vendor/bin/codecept run api -vvv tests/api/UserCest:getUserNotOwned'
Codeception PHP Testing Framework v5.0.11 https://helpukrainewin.org
App\Tests.api Tests (3) -----------------------------------------------------------------------------------
Modules: Cli, Asserts, Symfony, REST, Doctrine2, DataFactory, \App\Tests\Helper\Factories
-----------------------------------------------------------------------------------------------------------
UserCest: Get user not owned | "App\\Entity\\User\\Enum\\UserType",403
Signature: App\Tests\UserCest:getUserNotOwned
Test: tests/api/UserCest.php:getUserNotOwned
Scenario --
[Symfony] Can't set persistent service doctrine.orm.default_entity_manager: The "doctrine.orm.default_entity_manager" service is already initialized, you cannot replace it.
[Database] Transaction started
I have "App\Entity\User\User"
I am authenticated as "App\\Entity\\User\\Enum\\UserType"
I have "App\Entity\User\User",{"roles":["ROLE_USER"]}
I grab service "security.token_storage"
I grab service "lexik_jwt_authentication.jwt_manager"
I am bearer authenticated "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJpYXQiOjE2OTU5Mzc4MTEsImV4cCI6MTY5..."
I have valid json request
I have http header "Accept","application/ld+json"
I have http header "Content-Type","application/ld+json"
I send get "/users/1d2f2c63-8558-458f-89af-1eb4aa4e57e6"
[Request] GET /users/1d2f2c63-8558-458f-89af-1eb4aa4e57e6
[Request Headers] {"Authorization":"Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJpYXQiOjE2OTU5Mzc4MTEsImV4cCI6MTY5NTk0MTQxMSwicm9sZXMiOlsiUk9MRV9VU0VSIl0sInVzZXJuYW1lIjoianVsaWFubmUuYmFydG9sZXR0aUBsZWZmbGVyLmNvbSJ9.kVW5-wPcPdgQLzh_IOhM8Jru0255VC-n2GBECQ_lftGlh5KVfhU4PGXhloKBVFfjDwNR0WWLlWTy1ca7bxkSzQPCs708elmbKikW47LAsQ7c4oqa2VwRGWsTaxivWOFu6JbM-QfYbFCWIpmY8M7MJqaUZUh8KzDxyfuwr7XOG4cVVP8DaENdlFlDkfC7ETq4dfX5rd1qfw7x-ehea-2DujQtN-Qh1ekOlBh8L5jdizu_Orfmvr3QchCkDx_OmKHe2QE6CK36jz6pZ6LBlC1Mi_saj2_3KqYFtHEufc_6Gw1l7qSdRC3xO3qQJrGEHaY6u42RPO3WxLJWCPPNf56zYQ","Accept":"application/ld+json","Content-Type":"application/ld+json"}
ERROR
[Database] Transaction cancelled; all changes reverted.
UserCest: Get user not owned | "App\\Entity\\User\\Enum\\UserType",403
Signature: App\Tests\UserCest:getUserNotOwned
Test: tests/api/UserCest.php:getUserNotOwned
Scenario --
[Symfony] Can't set persistent service doctrine.orm.default_entity_manager: The "doctrine.orm.default_entity_manager" service is already initialized, you cannot replace it.
[Database] Transaction started
I have "App\Entity\User\User"
I am authenticated as "App\\Entity\\User\\Enum\\UserType"
I have "App\Entity\User\User",{"roles":["ROLE_ADMIN"]}
I grab service "security.token_storage"
I grab service "lexik_jwt_authentication.jwt_manager"
I am bearer authenticated "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJpYXQiOjE2OTU5Mzc4MTEsImV4cCI6MTY5..."
I have valid json request
I have http header "Accept","application/ld+json"
I have http header "Content-Type","application/ld+json"
I send get "/users/9ab329d2-e0a0-4f7d-91ae-1626761a7cc3"
[Request] GET /users/9ab329d2-e0a0-4f7d-91ae-1626761a7cc3
[Request Headers] {"Authorization":"Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJpYXQiOjE2OTU5Mzc4MTEsImV4cCI6MTY5NTk0MTQxMSwicm9sZXMiOlsiUk9MRV9VU0VSIiwiUk9MRV9BRE1JTiJdLCJ1c2VybmFtZSI6Indsb2NrbWFuQHlhaG9vLmNvbSJ9.QlCy0cScFoLZ-cKJKa5ORe832TNWaQoLR5B_8YZlEEZiOO0EGgMMHkwXTkZXgqrKWWqFhfdMwg7GsnEW4FSFqVgNovpwrMzWXshQEb_aV5ruCOFVWCQ2fod2S6-IExnJOTfwIYZwikg8pL-qoCL8aObHFk48BzRVKko7Pyd-na0gnw-Mv01V2V64clAYqAVAsuPo52TsNkIZ2GK4ZVWikZvQk3unthx1mZ3MkUFKMnSYyC-wZtCKcGD3I_DF071qSQ1aRMJV0aeEi5Xu853MJK8wKhw-TuYk1irGi2HKm3Iu-rfsKn0IHmGQHifyzQs8cm7xLARvRs_5HMmgPQ-HUQ","Accept":"application/ld+json","Content-Type":"application/ld+json"}
ERROR
[Database] Transaction cancelled; all changes reverted.
UserCest: Get user not owned | "App\\Entity\\User\\Enum\\UserType",200
Signature: App\Tests\UserCest:getUserNotOwned
Test: tests/api/UserCest.php:getUserNotOwned
Scenario --
[Symfony] Can't set persistent service doctrine.orm.default_entity_manager: The "doctrine.orm.default_entity_manager" service is already initialized, you cannot replace it.
[Database] Transaction started
I have "App\Entity\User\User"
I am authenticated as "App\\Entity\\User\\Enum\\UserType"
I have "App\Entity\User\User",{"roles":["ROLE_SUPER_ADMIN"]}
I grab service "security.token_storage"
I grab service "lexik_jwt_authentication.jwt_manager"
I am bearer authenticated "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJpYXQiOjE2OTU5Mzc4MTEsImV4cCI6MTY5..."
I have valid json request
I have http header "Accept","application/ld+json"
I have http header "Content-Type","application/ld+json"
I send get "/users/ffbb956c-7594-43be-ac15-bd412c782ccd"
[Request] GET /users/ffbb956c-7594-43be-ac15-bd412c782ccd
[Request Headers] {"Authorization":"Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJpYXQiOjE2OTU5Mzc4MTEsImV4cCI6MTY5NTk0MTQxMSwicm9sZXMiOlsiUk9MRV9VU0VSIiwiUk9MRV9TVVBFUl9BRE1JTiJdLCJ1c2VybmFtZSI6Im1lYWdhbi5kaWV0cmljaEBtb3NjaXNraS5vcmcifQ.rmMBe2bQ-hCVYCrxhAXT__9DIEIFfgNspt-JxfR2qvLuL9Q3_kYnAsCNXCKLd0M9j27zcV1hENrKC3-MNkvSO-OgQFksCYFDXPYOZkZwZ8N2vOK2E6vEr6r3Q9eLyOhLVLYWurqwGxbe6PwJgcZZYuKva-mImx3DQ6RIBmVLASHDVXyHmnjXkd_iSAHbSgFS6ZLUE2DuCEQjQOQxC-vw8GvDjURutWpXkNRQDfjS7G90ZtruHfnQozfRqnpsptv4PeN89Hm6PtOLl6tzBiixNJagcdgHA1jbmkTrm2VDN5pwh3ecQuqoUXMfn2P4hqKSXvcazlmRsD8dVU40MP3-8g","Accept":"application/ld+json","Content-Type":"application/ld+json"}
[Page] /users/ffbb956c-7594-43be-ac15-bd412c782ccd
[Response] 200
[Request Cookies] []
[Response Headers] {"content-type":["application/ld+json; charset=utf-8"],"vary":["Accept","Content-Type","Authorization","Origin"],"x-content-type-options":["nosniff"],"x-frame-options":["deny"],"cache-control":["no-cache, private"],"date":["Thu, 28 Sep 2023 21:50:11 GMT"],"link":["<http://localhost/docs.jsonld>; rel="http://www.w3.org/ns/hydra/core#apiDocumentation""],"etag":[""2e21a9d4fec4e18d04992c1c97fa07f4""],"x-robots-tag":["noindex"]}
[Shortened Response] {"@context":"/contexts/User","@id":"/users/ffbb956c-7594-43be-ac15-bd412c782ccd","@type":"User",
I see response code is 200
PASSED
[Database] Transaction cancelled; all changes reverted.
-----------------------------------------------------------------------------------------------------------
Time: 00:00.367, Memory: 64.50 MB
There were 2 errors:
1) UserCest: Get user not owned | "App\\Entity\\User\\Enum\\UserType",403
Test tests/api/UserCest.php:getUserNotOwned
[Doctrine\Common\Annotations\AnnotationException] [Semantical Error] The annotation "@part" in method Codeception\Module\REST::haveHttpHeader() was never imported. Did you maybe forget to add a "use" statement for this annotation?
Scenario Steps:
8. $I->sendGet("/users/1d2f2c63-8558-458f-89af-1eb4aa4e57e6") at tests/api/UserCest.php:49
7. $I->haveHttpHeader("Content-Type","application/ld+json") at tests/_support/ApiTester.php:54
6. $I->haveHttpHeader("Accept","application/ld+json") at tests/_support/ApiTester.php:53
5. $I->amBearerAuthenticated("eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJpYXQiOjE2OTU5Mzc4MTEsImV4cCI6MT...") at tests/_support/ApiTester.php:77
4. $I->grabService("lexik_jwt_authentication.jwt_manager") at tests/_support/ApiTester.php:75
3. $I->grabService("security.token_storage") at tests/_support/ApiTester.php:73
/app/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/AnnotationException.php:36
/app/vendor/symfony/security-http/Firewall/ExceptionListener.php:103
/app/vendor/symfony/event-dispatcher/Debug/WrappedListener.php:116
/app/vendor/symfony/event-dispatcher/EventDispatcher.php:220
/app/vendor/symfony/event-dispatcher/EventDispatcher.php:56
/app/vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php:139
/app/vendor/symfony/http-kernel/HttpKernel.php:240
/app/vendor/symfony/http-kernel/HttpKernel.php:91
/app/vendor/symfony/http-kernel/Kernel.php:197
/app/vendor/symfony/http-kernel/HttpKernelBrowser.php:65
/app/vendor/codeception/module-symfony/src/Codeception/Lib/Connector/Symfony.php:62
/app/vendor/symfony/browser-kit/AbstractBrowser.php:403
/app/vendor/codeception/lib-innerbrowser/src/Codeception/Lib/InnerBrowser.php:243
/app/vendor/codeception/lib-innerbrowser/src/Codeception/Lib/InnerBrowser.php:161
/app/vendor/codeception/module-rest/src/Codeception/Module/REST.php:693
/app/vendor/codeception/module-rest/src/Codeception/Module/REST.php:516
/app/vendor/codeception/codeception/src/Codeception/Step.php:289
/app/vendor/codeception/codeception/src/Codeception/Scenario.php:76
/app/tests/_support/_generated/ApiTesterActions.php:6008
/app/tests/api/UserCest.php:49
/app/vendor/codeception/codeception/src/Codeception/Lib/Di.php:130
/app/vendor/codeception/codeception/src/Codeception/Test/Cest.php:184
/app/vendor/codeception/codeception/src/Codeception/Test/Cest.php:194
/app/vendor/codeception/codeception/src/Codeception/Test/Cest.php:129
/app/vendor/codeception/codeception/src/Codeception/Test/Test.php:168
/app/vendor/codeception/codeception/src/Codeception/Suite.php:130
/app/vendor/codeception/codeception/src/Codeception/SuiteManager.php:148
/app/vendor/codeception/codeception/src/Codeception/Codecept.php:260
/app/vendor/codeception/codeception/src/Codeception/Codecept.php:216
/app/vendor/codeception/codeception/src/Codeception/Command/Run.php:435
/app/vendor/symfony/console/Command/Command.php:326
/app/vendor/symfony/console/Application.php:1063
/app/vendor/symfony/console/Application.php:320
/app/vendor/symfony/console/Application.php:174
/app/vendor/codeception/codeception/src/Codeception/Application.php:112
/app/vendor/codeception/codeception/app.php:45
/app/vendor/codeception/codeception/app.php:46
/app/vendor/codeception/codeception/codecept:7
/app/vendor/bin/codecept:119
2) UserCest: Get user not owned | "App\\Entity\\User\\Enum\\UserType",403
Test tests/api/UserCest.php:getUserNotOwned
[Doctrine\Common\Annotations\AnnotationException] [Semantical Error] The annotation "@part" in method Codeception\Module\REST::haveHttpHeader() was never imported. Did you maybe forget to add a "use" statement for this annotation?
Scenario Steps:
8. $I->sendGet("/users/9ab329d2-e0a0-4f7d-91ae-1626761a7cc3") at tests/api/UserCest.php:49
7. $I->haveHttpHeader("Content-Type","application/ld+json") at tests/_support/ApiTester.php:54
6. $I->haveHttpHeader("Accept","application/ld+json") at tests/_support/ApiTester.php:53
5. $I->amBearerAuthenticated("eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJpYXQiOjE2OTU5Mzc4MTEsImV4cCI6MT...") at tests/_support/ApiTester.php:77
4. $I->grabService("lexik_jwt_authentication.jwt_manager") at tests/_support/ApiTester.php:75
3. $I->grabService("security.token_storage") at tests/_support/ApiTester.php:73
/app/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/AnnotationException.php:36
/app/vendor/symfony/security-http/Firewall/ExceptionListener.php:103
/app/vendor/symfony/event-dispatcher/Debug/WrappedListener.php:116
/app/vendor/symfony/event-dispatcher/EventDispatcher.php:220
/app/vendor/symfony/event-dispatcher/EventDispatcher.php:56
/app/vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php:139
/app/vendor/symfony/http-kernel/HttpKernel.php:240
/app/vendor/symfony/http-kernel/HttpKernel.php:91
/app/vendor/symfony/http-kernel/Kernel.php:197
/app/vendor/symfony/http-kernel/HttpKernelBrowser.php:65
/app/vendor/codeception/module-symfony/src/Codeception/Lib/Connector/Symfony.php:62
/app/vendor/symfony/browser-kit/AbstractBrowser.php:403
/app/vendor/codeception/lib-innerbrowser/src/Codeception/Lib/InnerBrowser.php:243
/app/vendor/codeception/lib-innerbrowser/src/Codeception/Lib/InnerBrowser.php:161
/app/vendor/codeception/module-rest/src/Codeception/Module/REST.php:693
/app/vendor/codeception/module-rest/src/Codeception/Module/REST.php:516
/app/vendor/codeception/codeception/src/Codeception/Step.php:289
/app/vendor/codeception/codeception/src/Codeception/Scenario.php:76
/app/tests/_support/_generated/ApiTesterActions.php:6008
/app/tests/api/UserCest.php:49
/app/vendor/codeception/codeception/src/Codeception/Lib/Di.php:130
/app/vendor/codeception/codeception/src/Codeception/Test/Cest.php:184
/app/vendor/codeception/codeception/src/Codeception/Test/Cest.php:194
/app/vendor/codeception/codeception/src/Codeception/Test/Cest.php:129
/app/vendor/codeception/codeception/src/Codeception/Test/Test.php:168
/app/vendor/codeception/codeception/src/Codeception/Suite.php:130
/app/vendor/codeception/codeception/src/Codeception/SuiteManager.php:148
/app/vendor/codeception/codeception/src/Codeception/Codecept.php:260
/app/vendor/codeception/codeception/src/Codeception/Codecept.php:216
/app/vendor/codeception/codeception/src/Codeception/Command/Run.php:435
/app/vendor/symfony/console/Command/Command.php:326
/app/vendor/symfony/console/Application.php:1063
/app/vendor/symfony/console/Application.php:320
/app/vendor/symfony/console/Application.php:174
/app/vendor/codeception/codeception/src/Codeception/Application.php:112
/app/vendor/codeception/codeception/app.php:45
/app/vendor/codeception/codeception/app.php:46
/app/vendor/codeception/codeception/codecept:7
/app/vendor/bin/codecept:119
ERRORS!
Tests: 3, Assertions: 1, Errors: 2.
api-platform/core v3.2.0-beta.1 Build a fully-featured hypermedia or GraphQL AP...
api-platform/schema-generator v5.2.2 Various tools to generate a data model based on...
aws/aws-crt-php v1.2.2 AWS Common Runtime for PHP
aws/aws-sdk-php 3.281.15 AWS SDK forPHP - Use Amazon Web Servicesin yo...
behat/gherkin v4.9.0 Gherkin DSL parser for PHP
behat/transliterator v1.5.0 String transliterator
brick/math 0.11.0 Arbitrary-precision arithmetic library
cebe/php-openapi 1.7.0 Read and write OpenAPI yaml/json files and make...
codeception/codeception 5.0.11 BDD-style testing framework
codeception/lib-asserts 2.1.0 Assertion methods used by Codeception core and ...
codeception/lib-innerbrowser 4.0.0 Parent library for all Codeception framework mo...
codeception/lib-web 1.0.2 Library containing files used by module-webdriv...
codeception/lib-xml 1.0.1 Files used by module-rest and module-soap
codeception/module-asserts 3.0.0 Codeception module containing various assertions
codeception/module-cli 2.0.1 Codeception module for testing basic shell comm...
codeception/module-datafactory 3.0.0 DataFactory module for Codeception
codeception/module-doctrine2 3.0.3 Doctrine2 module for Codeception
codeception/module-rest 3.3.2 REST module for Codeception
codeception/module-symfony 3.1.1 Codeception module for Symfony framework
codeception/stub 4.1.1 Flexible Stub wrapper for PHPUnit's Mock Buildercomposer/pcre 3.1.0 PCRE wrapping library that offers type-safe pre...composer/semver 3.4.0 Semver library that offers utilities, version c...composer/xdebug-handler 3.0.3 Restarts a process without Xdebug.dama/doctrine-test-bundle v7.2.1 Symfony bundle to isolate doctrine database tes...doctrine/annotations 2.0.1 Docblock Annotations Parserdoctrine/cache 2.2.0 PHP Doctrine Cache library is a popular cache i...doctrine/collections 2.1.3 PHP Doctrine Collections library that adds addi...doctrine/common 3.4.3 PHP Doctrine Common project is a library that p...doctrine/data-fixtures 1.6.7 Data Fixtures for all Doctrine Object Managersdoctrine/dbal 3.7.0 Powerful PHP database abstraction layer (DBAL) ...doctrine/deprecations 1.1.2 A small layer on top of trigger_error(E_USER_DE...doctrine/doctrine-bundle 2.10.2 Symfony DoctrineBundledoctrine/doctrine-migrations-bundle 3.2.4 Symfony DoctrineMigrationsBundledoctrine/event-manager 2.0.0 The Doctrine Event Manager is a simple PHP even...doctrine/inflector 2.0.8 PHP Doctrine Inflector is a small library that ...doctrine/instantiator 2.0.0 A small, lightweight utility to instantiate obj...doctrine/lexer 2.1.0 PHP Doctrine Lexer parser library that can be u...doctrine/migrations 3.6.0 PHP Doctrine Migrations project offer additiona...doctrine/orm 2.16.2 Object-Relational-Mapper for PHPdoctrine/persistence 3.2.0 The Doctrine Persistence project is a set of sh...doctrine/sql-formatter 1.1.3 a PHP SQL highlighting libraryfakerphp/faker v1.23.0 Faker is a PHP library that generates fake data...friendsofphp/php-cs-fixer v3.30.0 A tool to automatically fix PHP code stylegedmo/doctrine-extensions v3.13.0 Doctrine behavioral extensionsgesdinet/jwt-refresh-token-bundle v1.1.3 Implements a refresh token system over Json Web...guzzlehttp/guzzle 7.8.0 Guzzle is a PHP HTTP client libraryguzzlehttp/promises 2.0.1 Guzzle promises libraryguzzlehttp/psr7 2.6.1 PSR-7 message implementation that also provides...hautelook/alice-bundle 2.12.1 Symfony bundle to manage fixtures with Alice an...jms/metadata 2.8.0 Class/method/property metadata management in PHPjustinrainbow/json-schema v5.2.13 A library to validate a json schema.lcobucci/clock 3.1.0 Yet another clock abstractionlcobucci/jwt 5.0.0 A simple library to work with JSON Web Token an...league/factory-muffin v3.3.0 The goal of this package is to enable the rapid...league/factory-muffin-faker v2.3.0 The goal of this package is to wrap faker to ma...league/flysystem 3.16.0 File storage abstraction for PHPleague/flysystem-aws-s3-v3 3.16.0 AWS S3 filesystem adapter for Flysystem.league/flysystem-bundle 3.2.0 Symfony bundle integrating Flysystem into Symfo...league/flysystem-local 3.16.0 Local filesystem adapter for Flysystem.league/html-to-markdown 5.1.1 An HTML-to-markdown conversion helper for PHPleague/mime-type-detection 1.13.0 Mime-type detection for Flysystemlexik/jwt-authentication-bundle v2.19.1 This bundle provides JWT authentication for you...masterminds/html5 2.8.1 An HTML5 parser and serializer.monolog/monolog 3.4.0 Sends your logs to files, sockets, inboxes, dat...mtdowling/jmespath.php 2.7.0 Declaratively specify how to extract elements f...myclabs/deep-copy 1.11.1 Create deep copies (clones) of your objectsnamshi/jose 7.2.3 JSON Object Signing and Encryption library for ...nelmio/alice 3.12.2 Expressive fixtures generatornelmio/cors-bundle 2.3.1 Adds CORS (Cross-Origin Resource Sharing) heade...nesbot/carbon 2.71.0 An API extension for DateTime that supports 281...nette/php-generator v4.1.0 🐘 Nette PHP Generator: generates neat PHP co...nette/utils v4.0.2 🛠 Nette Utils: lightweight utilities for st...nikic/php-parser v4.17.1 A PHP parser written in PHPphar-io/manifest 2.0.3 Component for reading phar.io manifest informat...phar-io/version 3.2.1 Library for handling version information and co...phpstan/phpdoc-parser 1.24.2 PHPDoc parser with support for nullable, inters...phpunit/php-code-coverage 10.1.6 Library that provides collection, processing, a...phpunit/php-file-iterator 4.1.0 FilterIterator implementation that filters file...phpunit/php-invoker 4.0.0 Invoke callables with a timeoutphpunit/php-text-template 3.0.1 Simple template engine.phpunit/php-timer 6.0.0 Utility class for timingphpunit/phpunit 10.3.5 The PHP Unit Testing framework.psr/cache 3.0.0 Common interface for caching librariespsr/clock 1.0.0 Common interface for reading the clock.psr/container 2.0.2 Common Container Interface (PHP FIG PSR-11)psr/event-dispatcher 1.0.0 Standard interfaces for event handling.psr/http-client 1.0.3 Common interface for HTTP clientspsr/http-factory 1.0.2 Common interfaces for PSR-7 HTTP message factoriespsr/http-message 2.0 Common interface for HTTP messagespsr/link 2.0.1 Common interfaces for HTTP linkspsr/log 3.0.0 Common interface for logging librariespsy/psysh v0.11.21 An interactive shell for modern PHP.ralouphie/getallheaders 3.0.3 A polyfill for getallheaders.ramsey/collection 2.0.0 A PHP library for representing and manipulating...ramsey/uuid 4.7.4 A PHP library for generating and working with u...ramsey/uuid-doctrine 2.0.0 Use ramsey/uuid as a Doctrine field type.roave/security-advisories dev-latest 4570a7d Prevents installation of composer packages with...runtime/frankenphp-symfony 0.1.1 FrankenPHP runtime for Symfonysebastian/cli-parser 2.0.0 Library for parsing CLI optionssebastian/code-unit 2.0.0 Collection of value objects that represent the ...sebastian/code-unit-reverse-lookup 3.0.0 Looks up which function or method a line of cod...sebastian/comparator 5.0.1 Provides the functionality to compare PHP value...sebastian/complexity 3.1.0 Library for calculating the complexity of PHP c...sebastian/diff 5.0.3 Diff implementationsebastian/environment 6.0.1 Provides functionality to handle HHVM/PHP envir...sebastian/exporter 5.1.1 Provides the functionality to export PHP variab...sebastian/global-state 6.0.1 Snapshotting of global statesebastian/lines-of-code 2.0.1 Library for counting the lines of code in PHP s...sebastian/object-enumerator 5.0.0 Traverses array structures and object graphs to...sebastian/object-reflector 3.0.0 Allows reflection of object attributes, includi...sebastian/recursion-context 5.0.0 Provides functionality to recursively process P...sebastian/type 4.0.0 Collection of value objects that represent the ...sebastian/version 4.0.1 Library that helps with managing the version nu...softcreatr/jsonpath 0.8.3 JSONPath implementation for parsing, searching ...stof/doctrine-extensions-bundle v1.8.0 Integration of the gedmo/doctrine-extensions wi...sweetrdf/easyrdf 1.10.0 EasyRdf is a PHP library designed to make it ea...sweetrdf/rdf-helpers 1.2.0 Set of low level helpers for implementing rdfIn...sweetrdf/rdf-interface 1.0.1 A common RDF interface for PHP RDF libraries.symfony/asset v6.3.0 Manages URL generation and versioning of web as...symfony/browser-kit v6.3.2 Simulates the behavior of a web browser, allowi...symfony/cache v6.3.4 Provides extended PSR-6, PSR-16 (and tags) impl...symfony/cache-contracts v3.3.0 Generic abstractions related to cachingsymfony/clock v6.3.4 Decouples applications from the system clocksymfony/config v6.3.2 Helps you find, load, combine, autofill and val...symfony/console v6.3.4 Eases the creation of beautiful and testable co...symfony/css-selector v6.3.2 Converts CSS selectors to XPath expressionssymfony/dependency-injection v6.3.4 Allows you to standardize and centralize the wa...symfony/deprecation-contracts v3.3.0 A generic function and convention to trigger de...symfony/doctrine-bridge v6.3.4 Provides integration for Doctrine with various ...symfony/dom-crawler v6.3.4 Eases DOM navigation for HTML and XML documentssymfony/dotenv v6.3.0 Registers environment variables from a .env filesymfony/error-handler v6.3.2 Provides tools to manage errors and ease debugg...symfony/event-dispatcher v6.3.2 Provides tools that allow your application comp...symfony/event-dispatcher-contracts v3.3.0 Generic abstractions related to dispatching eventsymfony/expression-language v6.3.0 Provides an engine that can compile and evaluat...symfony/filesystem v6.3.1 Provides basic utilities for the filesystemsymfony/finder v6.3.3 Finds files and directories via an intuitive fl...symfony/flex v2.3.3 Composer plugin for Symfonysymfony/form v6.3.2 Allows to easily create, process and reuse HTML...symfony/framework-bundle v6.3.4 Provides a tight integration between Symfony co...symfony/http-client v6.3.2 Provides powerful methods to fetch HTTP resourc...symfony/http-client-contracts v3.3.0 Generic abstractions related to HTTP clientssymfony/http-foundation v6.3.4 Defines an object-oriented layer for the HTTP s...symfony/http-kernel v6.3.4 Provides a structured process for converting a ...symfony/maker-bundle v1.51.1 Symfony Maker helps you create empty commands, ...symfony/mercure v0.6.3 Symfony Mercure Componentsymfony/mercure-bundle v0.3.7 Symfony MercureBundlesymfony/mime v6.3.3 Allows manipulating MIME messagessymfony/monolog-bridge v6.3.1 Provides integration for Monolog with various S...symfony/monolog-bundle v3.8.0 Symfony MonologBundlesymfony/options-resolver v6.3.0 Provides an improved replacement for the array_...symfony/password-hasher v6.3.0 Provides password hashing utilitiessymfony/phpunit-bridge v6.3.2 Provides utilities for PHPUnit, especially user...symfony/polyfill-intl-icu v1.28.0 Symfony polyfill for intl's ICU-related data an...
symfony/polyfill-intl-idn v1.28.0 Symfony polyfill for intl's idn_to_ascii and id...symfony/polyfill-php56 v1.20.0 Symfony polyfill backporting some PHP 5.6+ feat...symfony/polyfill-php83 v1.28.0 Symfony polyfill backporting some PHP 8.3+ feat...symfony/process v6.3.4 Executes commands in sub-processessymfony/property-access v6.3.2 Provides functions to read and write from/to an...symfony/property-info v6.3.0 Extracts information about PHP class' propertie...
symfony/routing v6.3.3 Maps an HTTP request to a set of configuration ...
symfony/runtime v6.3.2 Enables decoupling PHP applications from global...
symfony/security-bundle v6.3.4 Provides a tight integration of the Security co...
symfony/security-core v6.3.3 Symfony Security Component - Core Library
symfony/security-csrf v6.3.2 Symfony Security Component - CSRF Library
symfony/security-http v6.3.4 Symfony Security Component - HTTP Integration
symfony/serializer v6.3.4 Handles serializing and deserializing data stru...
symfony/service-contracts v3.3.0 Generic abstractions related to writing services
symfony/stopwatch v6.3.0 Provides a way to profile code
symfony/string v6.3.2 Provides an object-oriented API to strings and ...
symfony/translation v6.3.3 Provides tools to internationalize your applica...
symfony/translation-contracts v3.3.0 Generic abstractions related to translation
symfony/twig-bridge v6.3.2 Provides integration for Twig with various Symf...
symfony/twig-bundle v6.3.0 Provides a tight integration of Twig into the S...
symfony/validator v6.3.4 Provides tools to validate values
symfony/var-dumper v6.3.4 Provides mechanisms for walking through any arb...
symfony/var-exporter v6.3.4 Allows exporting any serializable PHP data stru...
symfony/web-link v6.3.0 Manages links between resources
symfony/web-profiler-bundle v6.3.2 Provides a development tool that gives detailed...
symfony/yaml v6.3.3 Loads and dumps YAML files
theofidry/alice-data-fixtures 1.6.0 Nelmio alice extension to persist the loaded fi...
theseer/tokenizer 1.2.1 A small library for converting tokenized PHP so...
twig/twig v3.7.1 Twig, the flexible, fast, and secure template l...
vich/uploader-bundle 2.2.0 Ease file uploads attached to entities
webmozart/assert 1.11.0 Assertions to validate method input/output with...
willdurand/negotiation 3.1.0 Content Negotiation tools for PHP provided as a...
zozlak/rdf-constants 1.2.1 A set of commonly used RDF and XSD constants
Suite configuration:
actor: ApiTestermodules:
# enable helpers as arrayenabled:
- Cli
- Asserts
- Symfony:
app_path: 'src'environment: 'test'mailer: 'symfony_mailer'
- REST:
url: /depends: Symfonypart: JsonshortDebugResponse: 100# only the first 100 chars of the response
- Doctrine2:
depends: Symfonycleanup: true
- DataFactory:
depends: Doctrine2
- App\Tests\Helper\Factories:
depends: DataFactory
The text was updated successfully, but these errors were encountered:
I removed stof/doctrine-extensions-bundle which was requiring doctrine/annotations:^2.0
Now another error comes my way
[TypeError] Cannot assign Symfony\Component\VarDumper\Caster\CutStub to reference held by property Codeception\Module\Symfony::$client of type ?Symfony\Component\BrowserKit\AbstractBrowser
What are you trying to achieve?
On an api platform project, I am trying to perform a simple endpoint security test.
Some of the scenarios should return a forbidden 403 response.
And I should assert the code is 403.
Tests pass. yay!
What do you get instead?
When trying manually with postman, I get the proper response payload, headers, and status code
However inside my codeception test, I just get a very strange error (which then prevents the test to go further)
[Doctrine\Common\Annotations\AnnotationException] [Semantical Error] The annotation "@part" in method Codeception\Module\REST::haveHttpHeader() was never imported. Did you maybe forget to add a "use" statement for this annotation?
Details
composer show
)The text was updated successfully, but these errors were encountered: