Trying to test the "Example 2.7 Using a data provider that returns an Iterator object" from PHPUnit online documentation but, it is not working - phpunit

A PHPUnit example from the online documentation is not working for me! Please see below for more details.
Your help is appreciated. Thank you in advance!
I'm trying to run the example test below from online documentation but, it is not working for me!
Example 2.7 Using a data provider that returns an Iterator object
The result I'm getting is shown below:
..#VivoBook MINGW64 ~/PHPunit/test-project
$ ./vendor/bin/phpunit --testdox dataProviders
PHPUnit 8.5.32 by Sebastian Bergmann and contributors.
Warning Test Case (PHPUnit\Framework\WarningTestCase)
⚠ Warning
│
│ The data provider specified for DataTest::testAdd is invalid.
│ Error: Class 'CsvFileIterator' not found
│ ..\PHPunit\test-project\dataProviders\DataProviderTest.php:16
│
Time: 77 ms, Memory: 4.00 MB
WARNINGS!
Tests: 1, Assertions: 0, Warnings: 1.
PHP info:
..#VivoBook MINGW64 ~/PHPunit/test-project
$ php -v
PHP 7.2.28 (cli) (built: Feb 18 2020 12:54:18) ( ZTS MSVC15 (Visual C++ 2017) x64 )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies

The issue appeared because the class in use was not loaded. Loading the class 'CsvFileIterator' using require/require_once solved the issue.

Related

Skipping precompilation since __precompile__(false)

I am developing little webapp with Genie 4 in Julia 1.7.3 on Linux mint 21. I have made some modules. While loading the app I got the following,
[ Info: 2022-09-13 21:28:08 Precompiling CreateApproveTeamPosts [top-level]
┌ Warning: Module FollowersController with build ID 963745445272 is missing from the cache.
│ This may mean FollowersController [top-level] does not support precompilation but is imported by a module that does.
└ # Base loading.jl:1107
[ Info: 2022-09-13 21:28:27 Skipping precompilation since __precompile__(false). Importing CreateApproveTeamPosts [top-level].
Questions:
Can anyone please explain whats happening?
In entire project, I don't have __precompile__(false). From where it's coming?

AndroidX AAPT colors not found

I checked a couple of tutorials and then dove in to Refactor>Migrate to AndroidX. I imported ActivityCompat, ContextCompat and DrawableCompat.
But now I am stuck getting a compile completed because of this error:
AAPT: C:\Program Data\Android\QiewProjects\DBQiew\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values-v31\values-v31.xml:3: error: resource android:color/system_neutral1_1000 not found.
C:\Program Data\Android\QiewProjects\DBQiew\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values-v31\values-v31.xml:4: error: resource android:color/system_neutral1_900 not found.
C:\Program Data\Android\QiewProjects\DBQiew\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values-v31\values-v31.xml:5: error: resource android:color/system_neutral1_0 not found.
.
.
.
It continues on for about 21 missing items. It appears AndroidX is looking for color files that are missing.
I have spent hours looking for a similar posting, but there aren't any. I have even tried Invalidate caches/Restart but that changed nothing.
Please point me to an explanation to find the missing files or disable the hunt for them. BTW I am using Studio 4.1.2 and compile and target SDK versions 29.
It turned out I had to revise the compile and targetSDK versions from 29 to 31.
It was not mandatory, but I also upgraded the following versions in app/build.gradle:
androidx.appcompat.appcompat:1.0.0 -> 1.4.1
androidx.core.core:1.0.0 -> 1.7.0
androidx.constraintlayout.constraintlayout:1.1.2 -> 2.1.3

xdebug : Fatal error with phpunit for code coverage

I wanna to test my code and coverage. I already install Xdebug extension and when I verify with php -v command, all i'ts good like that :
PHP 7.4.12 (cli) (built: Oct 27 2020 17:18:47) ( ZTS Visual C++ 2017 x64 )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Xdebug v3.0.0RC1, Copyright (c) 2002-2020, by Derick Rethans
with Zend OPcache v7.4.12, Copyright (c), by Zend Technologies
However if I run phpunit i have a fatal error :
PHPUnit 7.5.20 by Sebastian Bergmann and contributors.
Fatal error: Uncaught SebastianBergmann\CodeCoverage\RuntimeException: xdebug.coverage_enable=On has to be set in php.ini in C:\Users\quent\Desktop\Github\quentingeeraert-website\bin\.phpunit\phpunit-7.5-0\vendor\phpunit\php-code-coverage\src\Driver\Xdebug.php on line 42
SebastianBergmann\CodeCoverage\RuntimeException: xdebug.coverage_enable=On has to be set in php.ini in C:\Users\quent\Desktop\Github\quentingeeraert-website\bin\.phpunit\phpunit-7.5-0\vendor\phpunit\php-code-coverage\src\Driver\Xdebug.php on line 42
Call Stack:
0.0005 402112 1. {main}() C:\Users\quent\Desktop\Github\quentingeeraert-website\bin\phpunit:0
0.0027 477240 2. require('C:\Users\quent\Desktop\Github\quentingeeraert-website\vendor\symfony\phpunit-bridge\bin\simple-phpunit.php') C:\Users\quent\Desktop\Github\quentingeeraert-website\bin\phpunit:13
0.2824 501760 3. include('C:\Users\quent\Desktop\Github\quentingeeraert-website\bin\.phpunit\phpunit-7.5-0\phpunit') C:\Users\quent\Desktop\Github\quentingeeraert-website\vendor\symfony\phpunit-bridge\bin\simple-phpunit.php:405
0.2989 1149952 4. PHPUnit\TextUI\Command::main($exit = ???) C:\Users\quent\Desktop\Github\quentingeeraert-website\bin\.phpunit\phpunit-7.5-0\phpunit:22
0.2989 1150064 5. Symfony\Bridge\PhpUnit\Legacy\CommandForV6->run($argv = [0 => 'bin\\phpunit', 1 => '--colors=always', 2 => '--stop-on-failure'], $exit = TRUE) C:\Users\quent\Desktop\Github\quentingeeraert-website\bin\.phpunit\phpunit-7.5-0\src\TextUI\Command.php:162
I already add xdebug.coverage_enable = On in my php.ini file so I don't understand why the system say that :/
Maybe someone can help me ? Thank you a lot for help me !
I already add xdebug.coverage_enable = On in my php.ini file so I don't understand why the system say that :/
Xdebug v3.0.0RC1
PHPUnit 7.5.20
Either upgrade PHPUnit to the version that knows about Xdebug 3 ... or downgrade Xdebug to 2.x (2.9.8 is the latest).
Thing is: xdebug.coverage_enable is the Xdebug 2 option. That option does nothing in Xdebug 3 where you should use xdebug.mode = coverage instead.
Xdebug 3 uses different config options than v2 and your version of PHPUnit is simply not aware of that. Xdebug 3 will simply report an empty value/0 for no-longer-used Xdebug 2 options.
https://3.xdebug.org/docs/upgrade_guide#Changed-Configuration-Settings
P.S. You should see a warning when you run php -i with Xdebug 3 -- it should complain if such a wrong/outdated option is present in your php.ini (unless you have configured PHP to not to report any startup errors I guess).
In either case: run php -i and see the actual live values from Xdebug section: what value that option has.

Phpunit error "This build of PHPDBG does not support code coverage"

I'm getting error "This build of PHPDBG does not support code coverage" when try to run phpunit with coverage with phpdbg. I found in PHAR line which generate this error:
if (!\function_exists('PHPUnit\\phpdbg_start_oplog')) {
throw new \PHPUnit\SebastianBergmann\CodeCoverage\RuntimeException('This build of PHPDBG does not support code coverage');
}
Then i run and get this result:
prompt> ev function_exists('phpdbg_start_oplog');
1
As i undestand, problem is in namespace before phpdbg_start_oplog. So, why phpdbg_start_oplog is prefixed with PHPUnit namespace in PHAR?
PHPUnit 9.1.4 by Sebastian Bergmann and contributors.
PHP 7.4.1 (cli) (built: Dec 28 2019 11:16:02) ( NTS )
You found a bug in PHPUnit (or PHP-Scoper, one of the tools involved in building the PHAR distribution of PHPUnit). I opened a ticket for this issue on GitHub.

How do I fix the controlsfx demo program to initialize class org.controlsfx.glyphfont.FontAwesome?

The controlsfx JavaFX library has a demo program and some controls fail to run, such as List Selection View, or List Action View or BreadCrumbBar.
I re-tested this on a new Windows 10 PC, with JDK11 and Gradle 5.5 freshly installed. I downloaded the branch 9 .zip, verified that the module-info.java files are present, and entered
gradlew run
For the above mentioned examples, the console shows:
Exception in thread "JavaFX Application Thread" java.lang.NoClassDefFoundError: Could not initialize class org.controlsfx.glyphfont.FontAwesome
at org.controlsfx.samples/org.controlsfx.samples.HelloListActionView.createActions(HelloListActionView.java:144)
at org.controlsfx.samples/org.controlsfx.samples.HelloListActionView.getPanel(HelloListActionView.java:63)
at org.controlsfx.fxsampler/fxsampler.SampleBase.buildSample(SampleBase.java:77)
at org.controlsfx.fxsampler/fxsampler.FXSampler.buildSampleTabContent(FXSampler.java:397)
at org.controlsfx.fxsampler/fxsampler.FXSampler.updateTab(FXSampler.java:305)
at org.controlsfx.fxsampler/fxsampler.FXSampler.changeSample(FXSampler.java:296)
at org.controlsfx.fxsampler/fxsampler.FXSampler.lambda$start$1(FXSampler.java:159)
JAVA_HOME is C:\Program Files\Java\jdk-11.0.3
gradle --version
------------------------------------------------------------
Gradle 5.5
------------------------------------------------------------
Build time: 2019-06-28 17:36:05 UTC
Revision: 83820928f3ada1a3a1dbd9a6c0d47eb3f199378f
Kotlin: 1.3.31
Groovy: 2.5.4
Ant: Apache Ant(TM) version 1.9.14 compiled on March 12 2019
JVM: 11.0.3 (Oracle Corporation 11.0.3+12-LTS)
OS: Windows 10 10.0 amd64
I'd like to take advantage of FontAwesome as well as the above mentioned controls.
I experimented with
JDK 11, 11.0.1, 11.0.2, 11.0.2
Gradle 5.2, 5.5
Command line
IntelliJ
Another PC I usually develop on
ControlsFX has a large number of external dependencies which are handled in the build.gradle file.
If your project does not use gradle to build the library, but instead it imports a .jar of it, then you should add all those options to the VM. To do that in IntelliJ, go to Edit Configuration, there you can find a VM options field.
You can try to copy and paste these options:
--add-exports=javafx.graphics/com.sun.javafx.scene=org.controlsfx.controls --add-exports=javafx.graphics/com.sun.javafx.scene.traversal=org.controlsfx.controls --add-exports=javafx.graphics/com.sun.javafx.css=org.controlsfx.controls --add-exports=javafx.controls/com.sun.javafx.scene.control.behavior=org.controlsfx.controls --add-exports=javafx.controls/com.sun.javafx.scene.control=org.controlsfx.controls --add-exports=javafx.controls/com.sun.javafx.scene.control.inputmap=org.controlsfx.controls --add-exports=javafx.base/com.sun.javafx.event=org.controlsfx.controls --add-exports=javafx.base/com.sun.javafx.collections=org.controlsfx.controls --add-exports=javafx.base/com.sun.javafx.runtime=org.controlsfx.controls --add-exports=javafx.web/com.sun.webkit=org.controlsfx.controls --add-exports=javafx.graphics/com.sun.javafx.css=org.controlsfx.controls
This worked for me. I was facing the same issue with ControlsFX 11.0, while using ListSelectionView.

Resources