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

Add auto-generated smoke tests #59

Merged
merged 1 commit into from
Sep 24, 2024
Merged

Conversation

Pierstoval
Copy link
Contributor

Extracted from https://github.com/Pierstoval/SmokeTesting , as @COil doesn't want a Composer dependency for that, and the concept is straightforward anyway

@COil COil self-requested a review September 21, 2024 23:12
@COil
Copy link
Member

COil commented Sep 22, 2024

Thanks for PR @Pierstoval, check out php-cs-fixer errors please.

@Pierstoval
Copy link
Contributor Author

Done 👌

@COil
Copy link
Member

COil commented Sep 22, 2024

Hello,

Done 👌

Ok for php-cs-fixer but there are some PHPStan warnings.

------ --------------------------------------------------------------------- 
  Line   tests/Functional/Controller/StaticRoutesSmokeTest.php                
 ------ --------------------------------------------------------------------- 
  62     Generator expects key type string, mixed given.                      
         🪪  generator.keyType                                                
  62     Generator expects value type Symfony\Component\Routing\Route, mixed  
         given.                                                               
         🪪  generator.valueType                                              

To ensure the CI will pass, you can run (with xdebug enabled)

make ci 

Or for phpstan only :

make stan

*
* @author Alex "Pierstoval" Rock <[email protected]>
*/
class StaticRoutesSmokeTest extends WebTestCase
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AutomatedSmokeTest?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this test case doesn't cover dynamic route, automation is only related to specific routes, aka the static ones. I think adding "automated" would be too generic and less informative about what it actually does.


static::bootKernel();

/** @var TestContainer $container */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure these @var annotations are needed with the Symfony PHPStan plugin, to test.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's indeed not necessary for PHPStan, but it might be necessary for some IDEs that don't understand Symfony's DI rules. Some static analysers relying only on PHPDoc will also understand annotations better. I think we should keep it.

@COil
Copy link
Member

COil commented Sep 24, 2024

Thanks @Pierstoval :)

@COil COil merged commit fd953ca into strangebuzz:main Sep 24, 2024
3 checks passed
@Pierstoval Pierstoval deleted the smoke-tests branch September 24, 2024 08:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants