phpUnit Test Software

Username (e.g. epiz_XXX) or Website URL

Hidden by MOD

Error Message

No error message.

Other Information

I’m learning php. I understand that there’s server-side php automated test software called “phpunit” to do unit testing. (Not sure what this all is. Hopefully, you do.)
Is this already installed?
How could I get it installed?
It was not in the softalicious app list.

No, it’s not.
You can install it but you won’t be able to use it fully because there are some limits in the php.ini configuration that you are not able to change and there are some modules recommended that are not installed in InfinityFree’s servers.

The best place to check for that info is their website documentation:

https://phpunit.readthedocs.io/en/9.5/installation.html

2 Likes

That said to install PHPAR (PHP Archive).

PHAR is enabled on InfinityFree servers.
You shouldn’t be having problems using it.

1 Like

Correction:
It ALSO says, “There is no reason why PHPUnit should be installed on a webserver.”

I, obviously, have NO idea what I’m doing.

I agree with that statement.
PHPUnit should be installed wherever you are writing your code.

There are no details for installing on Win10.

That “installation” page has no details for installing PHPUnit AT ALL!!! References to phar, references to server configuration, references to composer.json (whatever that is), then warnings against global and webserver installation.

Argh!

InfinityFree’s servers run on Lynix, not Windows 10. Look for the installation for Lynix web servers.
Thanks

2 Likes

I’m writing the code on my Win10 PC at home.

If you are writing and testing PHP code in your Windows 10 PC, you need a server with PHP installed. That’s the only way to run an app/website written in PHP.

If you still don’t have one, how can you see if the code you’re writing is working?!

If it’s the first time you’re doing this, you will need a server that runs PHP. The most popular for Windows is XAMPP, that installs Apache, MySQL and PHP all at once. It’s free an open source.

PHPUnit will have to be installed in XAMPP. But first, you should read a bit about XAMPP, how it works and what it does, in their site.

1 Like

PHAR is enabled, but you need CLI access to run them, technically making them unusable on IF.

@TesFalcon This library is installed either through a PHAR File (basically a single file than imports everything needed) or by using Composer (The PHP package manager)

You really need a decent knowledge of how to use a Command Line Interface in order to use this library.

1 Like

Iam curious as to why you (think you) need unit testng for your php, since you don’t even know what this is as you say. My guess is that you are either a CS student or a professional working in a software engineering team, but in both these cases you should be in an environment where people can help you ‘hands on’ with what you (think you) want…
If you are just starting programming on your own, just learn the language, create a few projects and backends for web applications, and then after a few years you can concern yourself again with unit testing and see whether you really want to spend time on it or not…

I’m familiar with PhpUnit. The client area also has many PhpUnit tests.

PhpUnit isn’t installed on the client area servers though. It’s running on my own computer (so I can test code as I’m writing it) and it’s running on the automated testing system (GitLab CI) where all the changes to the code get tested automatically.

It’s not exactly installed on my computer though. PhpUnit is just PHP code itself, so all you need to run it is PHP. After that, you can install it with Composer. It can be installed on the system level or be setup only for the specific project you’re working on.

But PhpUnit, as well as all other development, debugging and testing tooling are not included when uploading the code to the live servers.

And while you could pull in PhpUnit with Composer and upload that to our servers, there is no point in doing so. Because to run PhpUnit, you need to run the PhpUnit command, and you can’t run system commands on our hosting.


So, all in all, you install PhpUnit on your own computer to test your code before uploading it to your website.

4 Likes

So after all that, I’m still nowhere closer to understanding what PHPUnit is, where it goes, how to access it, etc.

I could install it to the server but shouldn’t.
I should install it to my local machine, but there’s no install for it on Windows.

U run it “kinda” local, but not really.
It’s PHP, but not really.

So, w all the kindas and not reallys, I’m still trying to figure out what is real.

What do “system commands” (to the OS) and “PHPUnit commands” (to the testbed) have to do w each other?

Is it a VSCode Plugin?

So, instead of installing on your server, install it on my server when the instructions say to not install it on any server.

Xampp is a webserver for windows but phpunit has no install for windows, so that still doesn’t help me.

Thus the source of confusion for this entire conversation: what gets installed where, how, and how to use.

I write plain text php on my PC.
Upload to the webserver via FTP.
Access it via my browser to see if it worked or not.

Assuming that it was server-side installed to run PHP, I figured I would upload the “test script” to the server also.
Run the test script. Test:success.
Run for real.

Now, obviously, this whole scenario is as bunk as a politician’s promises. So what’s the REAL scenario.

No, kindas.
No, sortas.
No, not reallys.

Real. Straight. Truth.

All your questions show that is probably too soon to be worried about testing your PHP code.
You should probably start by learning how to write it, debug it, and how things work behind the scenes.

There is no installer for Windows like there is no installer for Linux or MAC. Most web software is not
installed using your usual .exe or .msi file.

There no .exe file to install Wordpress, Joomla, Drupal or MediaWiki. But you can install them all on the server that is running on your Windows machine. It’s different than installing PC software.
You just have a bunch of files and folders, with a bunch of scripts, a connection string and SQL (or noSQL) scripts to create and populate a database.

The real scenario is, “You’re very far from needing PHPUnit”.
Keep learning and training PHP while understanding how things work behind the scenes and you will end up understanding all this. Don’t worry about PHPUnit before you really need it. And you WILL KNOW when you need it.

2 Likes

7 yrs of coding and debugging in 7 full cycle projects from 1994-2001 are already under my stretched leather belt along w a 45 yr old gut.

All those you mention have “Click to Install” buttons readily accessible on the server. There’s no kinda, sorta, not really anything.

So, you’re insisting that this is server enhancing software that is installed on a server, just not that server, but some server somewhere of some kind?

Wordpress is a series of php files and associated MySQL db. Like most modern websites, there’s a separation between look (html/css) and functionality (javascript/php/mysql). While users can customize the front end look w prepackaged themes, they are limited via the Wordpress control panel on what can be customized in backend functionality.

Don’t talk down to me. I wrote a CMS in ASP/SQLServer in the 2000, 4 years before Wordpress came out.

I have a 20 year gap in technology not in my brain.

I hate Unix, but it has its uses. My FIL is a systems admin w 25+ years experience. He installs Linux distros for fun. Knowledge is NOT absorbed by osmosis.

Thanks, OB1, I never knew that PHP was the Force. I guess w the mods and enhancements that Facebook has done w it, they would be the Empire of Sith Lords w Mark Zuckerberg the Emperor.

This is starting to make sense now.