You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by "junichi11 (via GitHub)" <gi...@apache.org> on 2023/04/20 05:19:46 UTC

[GitHub] [netbeans] junichi11 opened a new pull request, #5853: Fix for PHPUnit 10 #5790

junichi11 opened a new pull request, #5853:
URL: https://github.com/apache/netbeans/pull/5853

   - https://github.com/apache/netbeans/issues/5790
   - Add `PhpUnitVersion`
   - Don't use `NetBeansSuite.php` with PHPUnit 10 because `suite()` method is invoked no longer and we have to extend `TestCase`
   - See: https://github.com/sebastianbergmann/phpunit/commit/36354a9cdc69ecabd20ac505b07541cfdde50aaa
   
   ![nb-php-gh-5790-phpunit10-project-properties](https://user-images.githubusercontent.com/738383/233264912-d6f0c662-b73e-4cec-b8c1-5a3be37e20fb.png)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] junichi11 commented on pull request #5853: Fix for PHPUnit 10 #5790

Posted by "junichi11 (via GitHub)" <gi...@apache.org>.
junichi11 commented on PR #5853:
URL: https://github.com/apache/netbeans/pull/5853#issuecomment-1519999600

   @tmysik I'll do that later :) This PR will be merged by the release team because I would like to include this in NB18. (We must not do it.) : https://lists.apache.org/thread/s3hnjtmr6t7dkyq1ofn4hdqmd0qh2d11
   Thank you!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] junichi11 commented on a diff in pull request #5853: Fix for PHPUnit 10 #5790

Posted by "junichi11 (via GitHub)" <gi...@apache.org>.
junichi11 commented on code in PR #5853:
URL: https://github.com/apache/netbeans/pull/5853#discussion_r1172388877


##########
php/php.phpunit/src/org/netbeans/modules/php/phpunit/ui/customizer/CustomizerPhpUnit.java:
##########
@@ -603,4 +632,23 @@ private void processUpdate() {
         }
     }
 
+    private static class PhpUnitVersionComboBoxModel extends DefaultComboBoxModel<PhpUnitVersion> {
+
+        private static final long serialVersionUID = 5850175934190021687L;
+
+        public PhpUnitVersionComboBoxModel() {
+            this(null);
+        }
+
+        public PhpUnitVersionComboBoxModel(PhpUnitVersion preselected) {
+            super(PhpUnitVersion.values());
+
+            if (preselected != null) {
+                setSelectedItem(preselected);

Review Comment:
   There is no big problem. I'll leave it as it is.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] tmysik commented on a diff in pull request #5853: Fix for PHPUnit 10 #5790

Posted by "tmysik (via GitHub)" <gi...@apache.org>.
tmysik commented on code in PR #5853:
URL: https://github.com/apache/netbeans/pull/5853#discussion_r1172405854


##########
php/php.phpunit/src/org/netbeans/modules/php/phpunit/ui/customizer/CustomizerPhpUnit.java:
##########
@@ -603,4 +632,23 @@ private void processUpdate() {
         }
     }
 
+    private static class PhpUnitVersionComboBoxModel extends DefaultComboBoxModel<PhpUnitVersion> {
+
+        private static final long serialVersionUID = 5850175934190021687L;
+
+        public PhpUnitVersionComboBoxModel() {
+            this(null);
+        }
+
+        public PhpUnitVersionComboBoxModel(PhpUnitVersion preselected) {
+            super(PhpUnitVersion.values());
+
+            if (preselected != null) {
+                setSelectedItem(preselected);

Review Comment:
   Up to you. I would perhaps try to keep the model without any logic, but this is really a nitpick; it is our internal class and it can be easily changed any time in the future.
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] tmysik commented on pull request #5853: Fix for PHPUnit 10 #5790

Posted by "tmysik (via GitHub)" <gi...@apache.org>.
tmysik commented on PR #5853:
URL: https://github.com/apache/netbeans/pull/5853#issuecomment-1518557116

   @junichi11 The ideal solution, of course 👍 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] tmysik commented on pull request #5853: Fix for PHPUnit 10 #5790

Posted by "tmysik (via GitHub)" <gi...@apache.org>.
tmysik commented on PR #5853:
URL: https://github.com/apache/netbeans/pull/5853#issuecomment-1518692128

   @KacerCZ 
   
   Let me improve my comment - I meant, can we always "extend" properly any existing configuration provided by the user? I am not so sure...
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] tmysik commented on pull request #5853: Fix for PHPUnit 10 #5790

Posted by "tmysik (via GitHub)" <gi...@apache.org>.
tmysik commented on PR #5853:
URL: https://github.com/apache/netbeans/pull/5853#issuecomment-1515926966

   Overall looks good to me. Here are my notes:
   
   - cannot we use the PHPUnit way also for older versions of PHPUnit? Maybe we could avoid the PHPUnit version selection at all?
   - cannot we detect what version of PHPUnit is used? I mean, some _cheap_ way, like existence of some file inside PHPUnit directory (not so nice but could work)
   - cannot we improve error message so user knows what to do if the running of the tests does not work? Something like "Verify PHPUnit version in the Project Properties dialog"
   
   Thanks!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] tmysik commented on a diff in pull request #5853: Fix for PHPUnit 10 #5790

Posted by "tmysik (via GitHub)" <gi...@apache.org>.
tmysik commented on code in PR #5853:
URL: https://github.com/apache/netbeans/pull/5853#discussion_r1172403514


##########
php/php.phpunit/src/org/netbeans/modules/php/phpunit/commands/PhpUnit.java:
##########
@@ -406,7 +407,12 @@ private TestParams getTestParams(PhpModule phpModule, TestRunInfo runInfo) throw
                 // standard suite
                 // #218607 - hotfix
                 //params.add(SUITE_NAME)
-                params.add(getNbSuite().getAbsolutePath());
+                if (PhpUnitPreferences.getPhpUnitVersion(phpModule) == PhpUnitVersion.PHP_UNIT_9) {
+                    params.add(getNbSuite().getAbsolutePath());
+                } else {
+                    // GH-5790 we can use NetBeansSuite.php no longer with PHPUnit 10
+                    params.add(FileUtil.toFile(startFiles.get(0)).getAbsolutePath());

Review Comment:
   And just to verify - is this the final change? It does not seem to me to be; or am I wrong? Thanks.
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] junichi11 commented on a diff in pull request #5853: Fix for PHPUnit 10 #5790

Posted by "junichi11 (via GitHub)" <gi...@apache.org>.
junichi11 commented on code in PR #5853:
URL: https://github.com/apache/netbeans/pull/5853#discussion_r1172395660


##########
php/php.phpunit/src/org/netbeans/modules/php/phpunit/ui/customizer/CustomizerPhpUnit.java:
##########
@@ -603,4 +632,23 @@ private void processUpdate() {
         }
     }
 
+    private static class PhpUnitVersionComboBoxModel extends DefaultComboBoxModel<PhpUnitVersion> {
+
+        private static final long serialVersionUID = 5850175934190021687L;
+
+        public PhpUnitVersionComboBoxModel() {
+            this(null);
+        }
+
+        public PhpUnitVersionComboBoxModel(PhpUnitVersion preselected) {
+            super(PhpUnitVersion.values());
+
+            if (preselected != null) {
+                setSelectedItem(preselected);

Review Comment:
   Or, I may remove this if I fix this issue without selecting the version.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] tmysik commented on a diff in pull request #5853: Fix for PHPUnit 10 #5790

Posted by "tmysik (via GitHub)" <gi...@apache.org>.
tmysik commented on code in PR #5853:
URL: https://github.com/apache/netbeans/pull/5853#discussion_r1172402460


##########
php/php.phpunit/src/org/netbeans/modules/php/phpunit/commands/PhpUnit.java:
##########
@@ -406,7 +407,12 @@ private TestParams getTestParams(PhpModule phpModule, TestRunInfo runInfo) throw
                 // standard suite
                 // #218607 - hotfix
                 //params.add(SUITE_NAME)
-                params.add(getNbSuite().getAbsolutePath());
+                if (PhpUnitPreferences.getPhpUnitVersion(phpModule) == PhpUnitVersion.PHP_UNIT_9) {

Review Comment:
   Maybe we could add a method into `PhpUnitVersion`, e.g. `usesNbSuite()` and call it here?
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] tmysik commented on a diff in pull request #5853: Fix for PHPUnit 10 #5790

Posted by "tmysik (via GitHub)" <gi...@apache.org>.
tmysik commented on code in PR #5853:
URL: https://github.com/apache/netbeans/pull/5853#discussion_r1172284068


##########
php/php.phpunit/src/org/netbeans/modules/php/phpunit/ui/customizer/CustomizerPhpUnit.java:
##########
@@ -603,4 +632,23 @@ private void processUpdate() {
         }
     }
 
+    private static class PhpUnitVersionComboBoxModel extends DefaultComboBoxModel<PhpUnitVersion> {
+
+        private static final long serialVersionUID = 5850175934190021687L;
+
+        public PhpUnitVersionComboBoxModel() {
+            this(null);
+        }
+
+        public PhpUnitVersionComboBoxModel(PhpUnitVersion preselected) {
+            super(PhpUnitVersion.values());
+
+            if (preselected != null) {
+                setSelectedItem(preselected);

Review Comment:
   I am just checking whether we are preventing some kind of error here, like NPE or similarly.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] tmysik commented on a diff in pull request #5853: Fix for PHPUnit 10 #5790

Posted by "tmysik (via GitHub)" <gi...@apache.org>.
tmysik commented on code in PR #5853:
URL: https://github.com/apache/netbeans/pull/5853#discussion_r1172407592


##########
php/php.phpunit/src/org/netbeans/modules/php/phpunit/commands/PhpUnit.java:
##########
@@ -406,7 +407,12 @@ private TestParams getTestParams(PhpModule phpModule, TestRunInfo runInfo) throw
                 // standard suite
                 // #218607 - hotfix
                 //params.add(SUITE_NAME)
-                params.add(getNbSuite().getAbsolutePath());
+                if (PhpUnitPreferences.getPhpUnitVersion(phpModule) == PhpUnitVersion.PHP_UNIT_9) {
+                    params.add(getNbSuite().getAbsolutePath());
+                } else {
+                    // GH-5790 we can use NetBeansSuite.php no longer with PHPUnit 10
+                    params.add(FileUtil.toFile(startFiles.get(0)).getAbsolutePath());

Review Comment:
   I am asking because it is - at least, I believe it is - possible to select more test files (using CTRL) and run them (so, test them using PHPUnit). I hope I am not wrong...
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] junichi11 commented on pull request #5853: Fix for PHPUnit 10 #5790

Posted by "junichi11 (via GitHub)" <gi...@apache.org>.
junichi11 commented on PR #5853:
URL: https://github.com/apache/netbeans/pull/5853#issuecomment-1516102062

   > * cannot we use the PHPUnit 10 way also for older versions of PHPUnit? Maybe we could avoid the PHPUnit version selection at all?
   
   Maybe, PHPUnit 9 works the same way (for a single file and directory). However, I'm not sure about the others...
   
   > * cannot we detect what version of PHPUnit is used? I mean, some _cheap_ way, like existence of some file inside PHPUnit directory (not so nice but could work)
   > * cannot we improve error message so user knows what to do if the running of the tests does not work? Something like "Verify PHPUnit version in the Project Properties dialog"
   
   I'll try thinking whether we can run unit test without selecting the version :)
   Thanks!
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] tmysik commented on pull request #5853: Fix for PHPUnit 10 #5790

Posted by "tmysik (via GitHub)" <gi...@apache.org>.
tmysik commented on PR #5853:
URL: https://github.com/apache/netbeans/pull/5853#issuecomment-1518589841

   @junichi11 Looks good to me. However, we still need to solve situation when several files should be tested (e.g. user selects more files, or re-run the failed tests).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] KacerCZ commented on pull request #5853: Fix for PHPUnit 10 #5790

Posted by "KacerCZ (via GitHub)" <gi...@apache.org>.
KacerCZ commented on PR #5853:
URL: https://github.com/apache/netbeans/pull/5853#issuecomment-1518690084

   I tried to find way how to pass multiple files to PHPUnit, but there is no easy way.
   
   Possible solution could be inspired by https://github.com/infection/infection.
   It manipulates XML configuration for PHPUnit to suit its needs and creates temporary XML file.
   This file is then passed to PHPUnit with `-c`/`--configuration` parameter.
   See
   - https://github.com/infection/infection/pull/1547
   - https://github.com/infection/infection/blob/master/src/TestFramework/PhpUnit/Config/XmlConfigurationManipulator.php
   
   **Proposal**
   
   1. NetBeans creates temporary XML file
      - if config file exists (specified in dialog configuration or default file name) then it copies its content
      - relative paths in new file needs to be updated for new location
      - if config file does not exist it creates new one
   2. create its own test suite with unique name (https://docs.phpunit.de/en/10.1/configuration.html#the-testsuite-element)
   3. add files/directories to the suite
   4. run PHPUnit with parameters `--configuration` and `--testsuite` (https://docs.phpunit.de/en/10.1/textui.html) to test selected files
   
   What do you think?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] tmysik commented on pull request #5853: Fix for PHPUnit 10 #5790

Posted by "tmysik (via GitHub)" <gi...@apache.org>.
tmysik commented on PR #5853:
URL: https://github.com/apache/netbeans/pull/5853#issuecomment-1518600369

   @junichi11 You are welcome!
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] tmysik commented on a diff in pull request #5853: Fix for PHPUnit 10 #5790

Posted by "tmysik (via GitHub)" <gi...@apache.org>.
tmysik commented on code in PR #5853:
URL: https://github.com/apache/netbeans/pull/5853#discussion_r1174386731


##########
php/php.phpunit/src/org/netbeans/modules/php/phpunit/PhpUnitVersion.java:
##########
@@ -40,10 +42,30 @@ public static PhpUnitVersion getDefault() {
         return phpUnitVersions[0];
     }
 
+    public static PhpUnitVersion fromString(@NonNull String version) {
+        Parameters.notNull("version", version); // NOI18N
+        String[] versions = version.split("\\."); // NOI18N
+        try {
+            int majorVersion = Integer.parseInt(versions[0]);
+            if (majorVersion >= 10) {
+                return PHP_UNIT_10;
+            } else if (majorVersion <= 9) {
+                return PHP_UNIT_9;
+            }

Review Comment:
   Nice, thanks!
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] KacerCZ commented on pull request #5853: Fix for PHPUnit 10 #5790

Posted by "KacerCZ (via GitHub)" <gi...@apache.org>.
KacerCZ commented on PR #5853:
URL: https://github.com/apache/netbeans/pull/5853#issuecomment-1518694426

   Existing configuration file must be copied to temporary file and modified - add test suite and update relative paths.
   
   Configuration file can be configured in NetBeans or PHPUnit is looking for `phpunit.xml`, `phpunit.dist.xml` or `phpunit.xml.dist` in working directory (root of project).


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] lbownik commented on a diff in pull request #5853: Fix for PHPUnit 10 #5790

Posted by "lbownik (via GitHub)" <gi...@apache.org>.
lbownik commented on code in PR #5853:
URL: https://github.com/apache/netbeans/pull/5853#discussion_r1172266475


##########
php/php.phpunit/src/org/netbeans/modules/php/phpunit/ui/customizer/CustomizerPhpUnit.java:
##########
@@ -603,4 +632,23 @@ private void processUpdate() {
         }
     }
 
+    private static class PhpUnitVersionComboBoxModel extends DefaultComboBoxModel<PhpUnitVersion> {
+
+        private static final long serialVersionUID = 5850175934190021687L;
+
+        public PhpUnitVersionComboBoxModel() {
+            this(null);
+        }
+
+        public PhpUnitVersionComboBoxModel(PhpUnitVersion preselected) {
+            super(PhpUnitVersion.values());
+
+            if (preselected != null) {
+                setSelectedItem(preselected);

Review Comment:
   it is a syntactic proposal , one line of code instead of five, feel free to ignore if you don't like it.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] junichi11 commented on a diff in pull request #5853: Fix for PHPUnit 10 #5790

Posted by "junichi11 (via GitHub)" <gi...@apache.org>.
junichi11 commented on code in PR #5853:
URL: https://github.com/apache/netbeans/pull/5853#discussion_r1174367013


##########
php/php.phpunit/src/org/netbeans/modules/php/phpunit/PhpUnitVersion.java:
##########
@@ -40,10 +42,30 @@ public static PhpUnitVersion getDefault() {
         return phpUnitVersions[0];
     }
 
+    public static PhpUnitVersion fromString(@NonNull String version) {
+        Parameters.notNull("version", version); // NOI18N
+        String[] versions = version.split("\\."); // NOI18N
+        try {
+            int majorVersion = Integer.parseInt(versions[0]);
+            if (majorVersion >= 10) {
+                return PHP_UNIT_10;
+            } else if (majorVersion <= 9) {
+                return PHP_UNIT_9;
+            }

Review Comment:
   Makes sense :) I'll add it. Thanks!



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] junichi11 commented on pull request #5853: Fix for PHPUnit 10 #5790

Posted by "junichi11 (via GitHub)" <gi...@apache.org>.
junichi11 commented on PR #5853:
URL: https://github.com/apache/netbeans/pull/5853#issuecomment-1518520481

   @tmysik We can detect the version via `phpunit --version`. What do you think?
   
   ![nb-php-fix-phpunit10](https://user-images.githubusercontent.com/738383/233765141-82e21313-9768-4765-962a-950c55179824.gif)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] junichi11 commented on pull request #5853: Fix for PHPUnit 10 #5790

Posted by "junichi11 (via GitHub)" <gi...@apache.org>.
junichi11 commented on PR #5853:
URL: https://github.com/apache/netbeans/pull/5853#issuecomment-1518614278

   I'll click the "Ready for review" button to merge this after CI passes. (This PR is merged by the release team.)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] tmysik commented on a diff in pull request #5853: Fix for PHPUnit 10 #5790

Posted by "tmysik (via GitHub)" <gi...@apache.org>.
tmysik commented on code in PR #5853:
URL: https://github.com/apache/netbeans/pull/5853#discussion_r1172439494


##########
php/php.phpunit/src/org/netbeans/modules/php/phpunit/commands/PhpUnit.java:
##########
@@ -406,7 +407,12 @@ private TestParams getTestParams(PhpModule phpModule, TestRunInfo runInfo) throw
                 // standard suite
                 // #218607 - hotfix
                 //params.add(SUITE_NAME)
-                params.add(getNbSuite().getAbsolutePath());
+                if (PhpUnitPreferences.getPhpUnitVersion(phpModule) == PhpUnitVersion.PHP_UNIT_9) {
+                    params.add(getNbSuite().getAbsolutePath());
+                } else {
+                    // GH-5790 we can use NetBeansSuite.php no longer with PHPUnit 10
+                    params.add(FileUtil.toFile(startFiles.get(0)).getAbsolutePath());

Review Comment:
   Exactly. This is the reason why we had to use `NetBeansSuite.php`. I am afraid we need to investigate how/whether this is supported in PHPUnit now...
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] tmysik commented on a diff in pull request #5853: Fix for PHPUnit 10 #5790

Posted by "tmysik (via GitHub)" <gi...@apache.org>.
tmysik commented on code in PR #5853:
URL: https://github.com/apache/netbeans/pull/5853#discussion_r1174360891


##########
php/php.phpunit/src/org/netbeans/modules/php/phpunit/PhpUnitVersion.java:
##########
@@ -40,10 +42,30 @@ public static PhpUnitVersion getDefault() {
         return phpUnitVersions[0];
     }
 
+    public static PhpUnitVersion fromString(@NonNull String version) {
+        Parameters.notNull("version", version); // NOI18N
+        String[] versions = version.split("\\."); // NOI18N
+        try {
+            int majorVersion = Integer.parseInt(versions[0]);
+            if (majorVersion >= 10) {
+                return PHP_UNIT_10;
+            } else if (majorVersion <= 9) {
+                return PHP_UNIT_9;
+            }

Review Comment:
   Some logging in `else` would be useful, I think.
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] tmysik commented on pull request #5853: Fix for PHPUnit 10 #5790

Posted by "tmysik (via GitHub)" <gi...@apache.org>.
tmysik commented on PR #5853:
URL: https://github.com/apache/netbeans/pull/5853#issuecomment-1519961910

   I totally agree, not a big problem definitely.
   
   BTW one more use-case is, if I remember it correctly 🙂, to rerun only failed tests. But that cannot work even now so all fine 👍 Let's create a ticket for it and merge this PR if there are no objections.
   
   Thanks!
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] junichi11 commented on pull request #5853: Fix for PHPUnit 10 #5790

Posted by "junichi11 (via GitHub)" <gi...@apache.org>.
junichi11 commented on PR #5853:
URL: https://github.com/apache/netbeans/pull/5853#issuecomment-1518599618

   @tmysik 
   > However, we still need to solve situation when several files should be tested (e.g. user selects more files, or re-run the failed tests).
   Yes. I'll submit that problem as a new issue after this is merged. (I have no ideas although I investigated a bit...)
   Thank you for your review!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] junichi11 commented on pull request #5853: Fix for PHPUnit 10 #5790

Posted by "junichi11 (via GitHub)" <gi...@apache.org>.
junichi11 commented on PR #5853:
URL: https://github.com/apache/netbeans/pull/5853#issuecomment-1520016807

   @neilcsmith-net Thank you!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] junichi11 commented on pull request #5853: Fix for PHPUnit 10 #5790

Posted by "junichi11 (via GitHub)" <gi...@apache.org>.
junichi11 commented on PR #5853:
URL: https://github.com/apache/netbeans/pull/5853#issuecomment-1518895606

   I noticed that only one file is run with also PHPUnit 9 when we select several files.
   
   1. Select two files (Tested files)
   2. Run > Test files
   
   Am I wrong something?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] junichi11 commented on pull request #5853: Fix for PHPUnit 10 #5790

Posted by "junichi11 (via GitHub)" <gi...@apache.org>.
junichi11 commented on PR #5853:
URL: https://github.com/apache/netbeans/pull/5853#issuecomment-1515733443

   The suite class file is checked whether it is a subclass of `TestCase`:
   https://github.com/sebastianbergmann/phpunit/blob/da707f3748773fbffd20289ae039e5e667d6b3a6/src/Runner/TestSuiteLoader.php#L42-L80


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] lbownik commented on a diff in pull request #5853: Fix for PHPUnit 10 #5790

Posted by "lbownik (via GitHub)" <gi...@apache.org>.
lbownik commented on code in PR #5853:
URL: https://github.com/apache/netbeans/pull/5853#discussion_r1172181368


##########
php/php.phpunit/src/org/netbeans/modules/php/phpunit/ui/customizer/CustomizerPhpUnit.java:
##########
@@ -603,4 +632,23 @@ private void processUpdate() {
         }
     }
 
+    private static class PhpUnitVersionComboBoxModel extends DefaultComboBoxModel<PhpUnitVersion> {
+
+        private static final long serialVersionUID = 5850175934190021687L;
+
+        public PhpUnitVersionComboBoxModel() {
+            this(null);
+        }
+
+        public PhpUnitVersionComboBoxModel(PhpUnitVersion preselected) {
+            super(PhpUnitVersion.values());
+
+            if (preselected != null) {
+                setSelectedItem(preselected);

Review Comment:
   how about
   setSelectedItem(preselected != null ? preselected : PhpUnitVersion.getDefault());



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] tmysik commented on a diff in pull request #5853: Fix for PHPUnit 10 #5790

Posted by "tmysik (via GitHub)" <gi...@apache.org>.
tmysik commented on code in PR #5853:
URL: https://github.com/apache/netbeans/pull/5853#discussion_r1172242241


##########
php/php.phpunit/src/org/netbeans/modules/php/phpunit/ui/customizer/CustomizerPhpUnit.java:
##########
@@ -603,4 +632,23 @@ private void processUpdate() {
         }
     }
 
+    private static class PhpUnitVersionComboBoxModel extends DefaultComboBoxModel<PhpUnitVersion> {
+
+        private static final long serialVersionUID = 5850175934190021687L;
+
+        public PhpUnitVersionComboBoxModel() {
+            this(null);
+        }
+
+        public PhpUnitVersionComboBoxModel(PhpUnitVersion preselected) {
+            super(PhpUnitVersion.values());
+
+            if (preselected != null) {
+                setSelectedItem(preselected);

Review Comment:
   Not needed, no? Or am I missing something?
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] tmysik commented on pull request #5853: Fix for PHPUnit 10 #5790

Posted by "tmysik (via GitHub)" <gi...@apache.org>.
tmysik commented on PR #5853:
URL: https://github.com/apache/netbeans/pull/5853#issuecomment-1519395882

   Uff :) Sorry, it has been a long time... Cannot we call `filesForContextOrSelectedNodes()`? But maybe the current behavior is "good enough" and running tests in a folder is what users do? Anyway, thanks for looking into it.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] junichi11 commented on pull request #5853: Fix for PHPUnit 10 #5790

Posted by "junichi11 (via GitHub)" <gi...@apache.org>.
junichi11 commented on PR #5853:
URL: https://github.com/apache/netbeans/pull/5853#issuecomment-1519190406

   @tmysik I should have written what I ran about that picture, sorry. I selected the directory to show failed results for 2 files. I'm not sure how to run the selected 2 files actually. So, I've looked into it a bit.
   
   https://github.com/apache/netbeans/blob/e65310a45ade2f08ce756536ce83bcc49237b101/php/php.project/src/org/netbeans/modules/php/project/ui/actions/support/CommandUtils.java#L299-L309
   
   It seems that the first item is returned when we select several files.
   
   https://github.com/apache/netbeans/blob/e65310a45ade2f08ce756536ce83bcc49237b101/php/php.project/src/org/netbeans/modules/php/project/ui/actions/support/ConfigActionTest.java#L172-L179


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] junichi11 commented on pull request #5853: Fix for PHPUnit 10 #5790

Posted by "junichi11 (via GitHub)" <gi...@apache.org>.
junichi11 commented on PR #5853:
URL: https://github.com/apache/netbeans/pull/5853#issuecomment-1519453883

   > Cannot we call `filesForContextOrSelectedNodes()`?
   
   We should be able to do it. Then, we have to fix `getTestRunInfoForFile()` or add `getTestRunInfoForFiles()`.
   
   > But maybe the current behavior is "good enough"
   
   Yes, I also think so :)
   
   > and running tests in a folder is what users do?
   
   I'm not sure... but maybe, usage is the following via CLI, so users didn't report anything about running several test files, I guess.
   
   ```
   Usage:
     phpunit [options] UnitTest.php
     phpunit [options] <directory>
   ```
   
   It doesn't seem a big problem for users (I think we need not hurry) because there is no report from users for a long time.
   At least, PHPUnit 10 should work with this PR if there are no wrong fixes in my changes :)
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] neilcsmith-net merged pull request #5853: Fix for PHPUnit 10 #5790

Posted by "neilcsmith-net (via GitHub)" <gi...@apache.org>.
neilcsmith-net merged PR #5853:
URL: https://github.com/apache/netbeans/pull/5853


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] tmysik commented on pull request #5853: Fix for PHPUnit 10 #5790

Posted by "tmysik (via GitHub)" <gi...@apache.org>.
tmysik commented on PR #5853:
URL: https://github.com/apache/netbeans/pull/5853#issuecomment-1518698172

   Cannot the existing configuration contain some suite already? I mean, can we _always_ update it? Sorry if it is clear and my questions are unnecessary 🙈
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] junichi11 commented on pull request #5853: Fix for PHPUnit 10 #5790

Posted by "junichi11 (via GitHub)" <gi...@apache.org>.
junichi11 commented on PR #5853:
URL: https://github.com/apache/netbeans/pull/5853#issuecomment-1521047635

   Created the issue: https://github.com/apache/netbeans/issues/5880


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] junichi11 commented on pull request #5853: Fix for PHPUnit 10 #5790

Posted by "junichi11 (via GitHub)" <gi...@apache.org>.
junichi11 commented on PR #5853:
URL: https://github.com/apache/netbeans/pull/5853#issuecomment-1518878457

   Thanks for investigating it. I'll submit that problem as a new issue later.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] tmysik commented on pull request #5853: Fix for PHPUnit 10 #5790

Posted by "tmysik (via GitHub)" <gi...@apache.org>.
tmysik commented on PR #5853:
URL: https://github.com/apache/netbeans/pull/5853#issuecomment-1519094066

   @junichi11 
   
   I can see 2 files were run, no?
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] junichi11 commented on a diff in pull request #5853: Fix for PHPUnit 10 #5790

Posted by "junichi11 (via GitHub)" <gi...@apache.org>.
junichi11 commented on code in PR #5853:
URL: https://github.com/apache/netbeans/pull/5853#discussion_r1172417641


##########
php/php.phpunit/src/org/netbeans/modules/php/phpunit/commands/PhpUnit.java:
##########
@@ -406,7 +407,12 @@ private TestParams getTestParams(PhpModule phpModule, TestRunInfo runInfo) throw
                 // standard suite
                 // #218607 - hotfix
                 //params.add(SUITE_NAME)
-                params.add(getNbSuite().getAbsolutePath());
+                if (PhpUnitPreferences.getPhpUnitVersion(phpModule) == PhpUnitVersion.PHP_UNIT_9) {
+                    params.add(getNbSuite().getAbsolutePath());
+                } else {
+                    // GH-5790 we can use NetBeansSuite.php no longer with PHPUnit 10
+                    params.add(FileUtil.toFile(startFiles.get(0)).getAbsolutePath());

Review Comment:
   Yes, you are right. However, I'm not sure the way to run multiple files...
   We could do it via `NetBeansSuite.php`, so far, right?
   
   ```
   php vendor/bin/phpunit --help
   PHPUnit 10.1.1 by Sebastian Bergmann and contributors.
   
   Usage:
     phpunit [options] UnitTest.php
     phpunit [options] <directory>
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] junichi11 commented on pull request #5853: Fix for PHPUnit 10 #5790

Posted by "junichi11 (via GitHub)" <gi...@apache.org>.
junichi11 commented on PR #5853:
URL: https://github.com/apache/netbeans/pull/5853#issuecomment-1515734528

   @tmysik What do you think? Any ideas?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] junichi11 commented on a diff in pull request #5853: Fix for PHPUnit 10 #5790

Posted by "junichi11 (via GitHub)" <gi...@apache.org>.
junichi11 commented on code in PR #5853:
URL: https://github.com/apache/netbeans/pull/5853#discussion_r1174385790


##########
php/php.phpunit/src/org/netbeans/modules/php/phpunit/PhpUnitVersion.java:
##########
@@ -40,10 +42,30 @@ public static PhpUnitVersion getDefault() {
         return phpUnitVersions[0];
     }
 
+    public static PhpUnitVersion fromString(@NonNull String version) {
+        Parameters.notNull("version", version); // NOI18N
+        String[] versions = version.split("\\."); // NOI18N
+        try {
+            int majorVersion = Integer.parseInt(versions[0]);
+            if (majorVersion >= 10) {
+                return PHP_UNIT_10;
+            } else if (majorVersion <= 9) {
+                return PHP_UNIT_9;
+            }

Review Comment:
   Fixed: https://github.com/apache/netbeans/compare/bcfb8f7cf2e9aecd60f51ef32aa97f0fabc61cb7..6ac8eac427e4e3e315bf68f10faf6a2cf5d99147



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] tmysik commented on pull request #5853: Fix for PHPUnit 10 #5790

Posted by "tmysik (via GitHub)" <gi...@apache.org>.
tmysik commented on PR #5853:
URL: https://github.com/apache/netbeans/pull/5853#issuecomment-1518691775

   @KacerCZ 
   
   Thanks for looking into it! I was thinking about this solution also for the original solution (instead of `NetBeansSuite.php`), however, it cannot work in cases when the user already has any existing PHPUnit configuration. Or am I missing something?
   
   cc @junichi11 
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] junichi11 commented on a diff in pull request #5853: Fix for PHPUnit 10 #5790

Posted by "junichi11 (via GitHub)" <gi...@apache.org>.
junichi11 commented on code in PR #5853:
URL: https://github.com/apache/netbeans/pull/5853#discussion_r1172408362


##########
php/php.phpunit/src/org/netbeans/modules/php/phpunit/commands/PhpUnit.java:
##########
@@ -406,7 +407,12 @@ private TestParams getTestParams(PhpModule phpModule, TestRunInfo runInfo) throw
                 // standard suite
                 // #218607 - hotfix
                 //params.add(SUITE_NAME)
-                params.add(getNbSuite().getAbsolutePath());
+                if (PhpUnitPreferences.getPhpUnitVersion(phpModule) == PhpUnitVersion.PHP_UNIT_9) {

Review Comment:
   Yes, it's good way!



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] KacerCZ commented on pull request #5853: Fix for PHPUnit 10 #5790

Posted by "KacerCZ (via GitHub)" <gi...@apache.org>.
KacerCZ commented on PR #5853:
URL: https://github.com/apache/netbeans/pull/5853#issuecomment-1518710676

   @tmysik No need to apologize.
   Configuration file can contain one or more suites already defined.
   Idea is to add new test suite definition with and run this new suite.
   
   Name of the suite could be something like "NetBeansTempSuite" with MD5 hash created from pathnames passed from Netbeans to prevent name collision with already existing suite.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] tmysik commented on pull request #5853: Fix for PHPUnit 10 #5790

Posted by "tmysik (via GitHub)" <gi...@apache.org>.
tmysik commented on PR #5853:
URL: https://github.com/apache/netbeans/pull/5853#issuecomment-1518711421

   Ha, if we can _add_ a suite, then it seems to me to be the best way to go. Thanks for clarification!
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] neilcsmith-net commented on pull request #5853: Fix for PHPUnit 10 #5790

Posted by "neilcsmith-net (via GitHub)" <gi...@apache.org>.
neilcsmith-net commented on PR #5853:
URL: https://github.com/apache/netbeans/pull/5853#issuecomment-1520010912

   > This PR will be merged by the release team because I would like to include this in NB18.
   
   Don't worry, I've been following the conversation! :smile:
   
   I know it's been moved out of draft, but wasn't 100% sure from the ongoing conversation if it is ready to merge.  Please confirm, and I'll merge by tomorrow in time for 18-rc2.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists