How to write unit tests in Laminas api tools for the resources not for controller

How to write tests for resources that extend this class Laminas\ApiTools\Rest\AbstractResourceListener, I don’t think the official documentation has anything related to this


class can be extended only for controller

Hey @karthikeyan-manivasa, welcome to the laminas forums.

Have you seen the tests folder in the api-tools-rest package?

Hi @ezkimo thanks, I’ve observed the test folder and I’m uncertain about whether we should extend classes like laminas-test . Furthermore, I’ve noticed that the vendor and zip downloads lack test files. My understanding is that tests should be present to verify the functionality of this module. Could you provide more insights, particularly regarding the testing approach for custom resources?

Since you have also opened an issue report, two comments on it:

  1. It is very honourable that you are asking for tests, but in fact you are the first. That’s why there hasn’t been much in this direction.
  2. The laminas-api-tools are discontinued. (There will be new API tooling for Mezzio like specialized skeletons, code generation, and other features.)

@froschdesign, There will be no more development for API Tools? Is there a plan to disconnect Laminas MVC as well? Thanks!

Correct. The fact is that there is a lack of manpower, which is why the API tools cannot be continued.

No, laminas-mvc is not affected by this. On the contrary, version 4 is being actively worked on.

@froschdesign, is there anything to keep the API tool working? If there is a lack of manpower I can help. It is just the standards you people want for it, I may not qualify for it. But I can fix some errors. Thanks!

The problem is that there is too much to do and the UI alone requires in-depth knowledge. When the new version of laminas-servicemanager is released, it becomes very time-consuming. Also the RDBMS layer must be rewritten because laminas-db is in security-only maintenance mode.

Well, I can only hope for a new and better version of the API tool. Thanks for the information.