Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove final from all classes of this repository #1026

Open
gmponos opened this issue May 14, 2024 · 2 comments
Open

Remove final from all classes of this repository #1026

gmponos opened this issue May 14, 2024 · 2 comments
Labels
bug Something isn't working triage Need triage

Comments

@gmponos
Copy link

gmponos commented May 14, 2024

Your client library and Google Ads API versions:

  • Client library version: v23.0.1
  • Google Ads API version: V16

Your environment:

  • The PHP version: 8.3.

Description of the bug:

It has been raised in various issues that since (I think) v21.0 where you marked many classes as final it is a trouble for many developers to mock/test their applications.

You can find other related GH issues here:

#1008
#639
#294
#347

It is mentioned in these issues that the practice of marking classes as final should be done when you are following some very specific design/coding practices. More info when to mark as final your classes can be found here:

https://ocramius.github.io/blog/when-to-declare-classes-final/

As a result our application is not able to move from v15 to v16 because currently we are unable to mock classes of this package. If we are not able to mock the classes then our Unit tests will end up performing actual HTTP calls over the internet. This has various defects as our pipelines/jobs depend on external resources.

More specifically this is the class that we are trying to mock https://github.com/googleads/google-ads-php/blob/main/src/Google/Ads/GoogleAds/V16/Services/Client/ConversionUploadServiceClient.php but we can't.

I would advise to remove the final from all your classes since the package in many cases does not follow design and coding practices to support having classes as final and it would be troublesome to come back and report each class every time there is a problem with that one.

@gmponos gmponos added bug Something isn't working triage Need triage labels May 14, 2024
@gmponos
Copy link
Author

gmponos commented May 31, 2024

Hi, any response on this one?

@fiboknacky
Copy link
Member

@gmponos

Sorry for the delayed response! I need to talk to the source generation tool owner and we may be able to overwrite its behavior for the Google Ads API library.
I know that it's not ideal for you, but in the meantime, you can consider using this while waiting for the change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage Need triage
Projects
None yet
Development

No branches or pull requests

2 participants