Is it possible to run CI3 unit tests without sudo privileges? |
I don't know how extensively unit testing was used in CI3, but I was reading the instructions in the tests/README.md file and they seem quite preliminary -- and require you to install PEAR packages and stuff. Does anyone have experience running the CI3 unit tests? Is it possible to do this using composer instead of installing system-wide packages with PEAR?
(03-07-2023, 06:06 PM)kenjis Wrote: See https://github.com/kenjis/ci-phpunit-test Thank you, @kenjis, for this suggestion. I'm finally getting around to trying it. I note that the steps you outline in your README results in a LOT of files being added to one's application folder. The ci-phpunit-test-3.0.4/application/tests folder has 1025 files in it, including 4 shell scripts, 669 PHP files, and hundreds of other files. I also note that running install.php doesn't appear to change any files, at least none that git can detect. Also, I ran into an error installing phpunit via composer: Code: $ ./composer.phar require phpunit/phpunit --dev Finally, the tests would not run. Code: $ vendor/bin/phpunit -c application/tests/
See https://stackoverflow.com/questions/7313...-vfsstream
I don't know the phpunit error. Can you show your environment? OS, PHP, CI3 version? (03-21-2023, 04:09 PM)kenjis Wrote: See https://stackoverflow.com/questions/7313...-vfsstreamI had seen a lot of posts instructing one to change various lines to lowercase in composer.json but this didn't work on my machine. I eventually saw this SO post saying there's an issue with the sed command which causes a problem on MacOS. I've been unable to find a solution yet for it. However, composer appears to install phpunit, and I can get it to report its version: Code: $ vendor/bin/phpunit --version (03-21-2023, 04:09 PM)kenjis Wrote: I don't know the phpunit error. I'm running MacOS 10.15.7: Code: $ sw_vers My PHP version is 8.2.3, installed via brew: Code: $ php -v I've tried both the CI3 dev branch from about an hour ago (I think this is a6faab2 commit from Jan 26), and the gxgpet 8.2 pull request -- both of these report CI_VERSION of 3.2.0-dev. The CI3 dev branch barfs a lot of deprecated complaints because the devs haven't applied the 8.2 fix.
ci-phpunit-test works with release versions of CI3.
If APIs change in develop branch, it probably does not work.
ci-phpunit-test replaces some files in CI3,
because CI3 app is basically untestable without modifications. All these files are located in tests/_ci_phpunit_test/replacing/ And if you want to work with CI3 develop version, you need to update these files. See https://github.com/kenjis/ci-phpunit-test/pull/140 The PR may show you what you do. (03-21-2023, 05:24 PM)kenjis Wrote: ci-phpunit-test replaces some files in CI3, Do you mean to say that using kenjis/ci-phpunit-test requires that I replace core CodeIgniter system files? Does this happen automatically when you run ci-phpunit-test/install.php? Or must I replace these files manually? I just downloaded the latest release, CI 3.1.13, from here and ran your install instructions here and I can't see that any changes have been made to the native CodeIgniter system files (CodeIgniter.php, Common.php, etc.). The installer does report a lot of files being copied, but my git repo reports no file changes after I run your install.php. (03-21-2023, 05:24 PM)kenjis Wrote: And if you want to work with CI3 develop version, you need to update these files. Hmmm...I don't think I'm the right person to update ci-phpunit-test to work with the develop branch of CI3 (3.2-dev). I've only just attempted to use it and don't have a feel for how it works -- or why are there so many files?. It seems to me like quite an involved installation just to do some unit testing. Am I correct in thinking that most of those 650+ PHP files that you install are unit tests, and that CI3 doesn't come with any unit tests of its own? Incidentally, I just noticed that there are no releases for CI3 on github. Seems like an oversight by the repo maintainers. |
Welcome Guest, Not a member yet? Register Sign In |