-
-
Notifications
You must be signed in to change notification settings - Fork 145
♻️ Use PHPUnit's attributes in place of annotations (#884) #904
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
Conversation
|
This PR touches files which potentially affect the outcome of the tests of an exercise. This will cause all students' solutions to affected exercises to be re-tested. If this PR does not affect the result of the test (or, for example, adds an edge case that is not worth rerunning all tests for), please add the following to the merge-commit message which will stops student's tests from re-running. Please copy-paste to avoid typos. For more information, refer to the documentation. If you are unsure whether to add the message or not, please ping |
|
@homersimpsons So quick and so many changes :) I hope to get to it on the weekend. |
Yes, it took me 30 minutes to 1 hour to check the whole diff. Most of the files had the same changes, also the diff count per file also gives confidence at a quick glance. |
|
Currently on vacation, so would need some time to review this, can do it somewhen next week. |
mk-mxp
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only a few problems, automation is great!
One thing I am unsure about: Why do we have \ on students stubs exceptions, but not on those in the tests? Technically \ is not required, as there are no namespaces set. Should we remove them?
1. Used rector with the following configuration:
```php
<?php
declare(strict_types=1);
use Rector\Config\RectorConfig;
use Rector\PHPUnit\Set\PHPUnitSetList;
return RectorConfig::configure()
->withPaths([__DIR__ . '/exercises'])
->withSets([PHPUnitSetList::ANNOTATIONS_TO_ATTRIBUTES, PHPUnitSetList::PHPUNIT_110])
->withImportNames(importShortClasses: false, removeUnusedImports: true);
```
2. Manually fix testdox that contains `::`:
```diff
-#[TestDox(specify a string type for Address::$street)]
+#[TestDox('specify a string type for Address::$street')]
```
3. Updated `TestGenerator.php` to use attribute
4. Updated `bootstrap.sh` to use attribute
33ebb3b to
5ef73ab
Compare
mk-mxp
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for contributing this!
:::TestGenerator.phpto use attributebootstrap.shto use attribute