PHP Classes

fatal error

Recommend this page to a friend!

      AssetInc  >  All threads  >  fatal error  >  (Un) Subscribe thread alerts  
Subject:fatal error
Summary:Class 'PHPUnit_Framework_TestCase' not found
Messages:6
Author:OSWALDO OLEA
Date:2016-05-14 08:46:45
 

  1. fatal error   Reply   Report abuse  
Picture of OSWALDO OLEA OSWALDO OLEA - 2016-05-14 08:46:45
excuse my ignorance, but as I undertand, when loading file AssetIncTest.php, on line 5, on "extends" class it calls "\PHPUnit_Framework_TestCase", but there is no file class in the package by that name? ......what do I not understand or is it really an error?.....

Fatal error: Class 'PHPUnit_Framework_TestCase' not found in C:\xampp\htdocs\web_oriented\php\assetinc\tests\AssetIncTest.php on line 6

  2. Re: fatal error   Reply   Report abuse  
Picture of Gavin Gordon Markowski Gavin Gordon Markowski - 2016-05-14 10:15:39 - In reply to message 1 from OSWALDO OLEA
Hello.

PHPUnit is a PHP class for unit testing user-created PHP classes. In doing so, the results from PHPUnits' tests are used to provide the developer of the PHP class in question, and its users, with feedback regarding its overall functionality. If errors are found in the syntax or data of the PHP class(es) being tested, and/or any other problems are encountered during testing, PHPUnit will make a detailed error log, so you can address the problems and resolve them much more quickly. Otherwise, if no errors or problems were found during the testing process, it means that your PHP class(es) have successfully passed the testing procedure and are functioning in the way that its developer has intended. As such, PHPUnit is widely used by developers to show other prospective users/developers/programmers/etc that their PHP package(s) and/or class(es) are reliable, do not contain errors, and, as a result, are evidently safe to use. The most common means of utilizing PHPUnit is via Composer (a powerful PHP packages autoloader)[https://getcomposer.org], and, usually in combination with, TravisCI (a code inspection environment)[https://travis-ci.org], where test results produced by PHPUnit are shown in almost real-time, via a GUI (graphic user interface).

  3. Re: fatal error   Reply   Report abuse  
Picture of OSWALDO OLEA OSWALDO OLEA - 2016-05-14 10:32:51 - In reply to message 2 from Gavin Gordon Markowski
thanks for the explaination, now I understand a little more about PHPUnits and composer, unfortunately I haven't use neither of this two before, but I think is time to and your reply encourages me to.

question: the folder and file:
"vendor/autoload.php"
where do I suppose to get them from?
...in the packege I don't see them, but provably I just don't understand how they are included too...

  4. Re: fatal error   Reply   Report abuse  
Picture of Gavin Gordon Markowski Gavin Gordon Markowski - 2016-05-14 11:23:26 - In reply to message 1 from OSWALDO OLEA
... So, to state my point, and to conclude my last reply, the reason that you are encountering that error message about PHPUnit is because, I'm assuming, you:

a) improperly installed/haven't installed/don't use Composer;
b) aren't utilizing Travis.Ci's code inspection environment;
c) have incorrectly implemented PSR-4/0 namespacing;
d) didn't include the PHPUnit/Composer autoload.php file;
e) tried to instantiate the 'AssetIncTest' class by itself;

If any number of these items above are true, I'm more than happy and willing to teach you all I know about the subject in question, pertaining to matter with which you're having difficulties with, whichever one(s) it/they may be. : - )

However, if I've made a mistake, and none of the above items accounts for the error you have encountered, or for any other reason, I apologize for having misunderstood you; so, to help me to better understand you, please explain your concerns to me futher and in greater detail.

Sincerely,
Gavin Gordon Markowski

  5. Re: fatal error   Reply   Report abuse  
Picture of Gavin Gordon Markowski Gavin Gordon Markowski - 2016-05-14 17:34:02 - In reply to message 3 from OSWALDO OLEA
The 'vendor/autoload.php' files are created upon initializing Composer via the 'install' or 'require [vendor]/[package]' cmd. You see, Composer is used first as a command-line interface module in a console window. I use PowerShell, when developing on my PC; and, when developing on my server, I use Linux's console. (You can install Composer at the link I provided in my initial response.) Once you've installed it, and you've 'composer install'-ed and/or 'composer require [vendor]/[package]'-ed a PHP package into a root directory of a website, it will create a 'vendor' folder, which will contain all of the packages you have 'required', along with the 'autoload.php'. This allows you to autoload all of those packages into your website/WebApp/etc simply by including that one file.
Once you've installed it, try testing out by installing one of my packages to a directory:

In a console window, type:
composer require gavinggordon/htmlentities

Then, hit the enter key. You will see some response text, as a result, in the console window. Once the process is finished, the 'vendor' directory will be in the directory in which you were when you typed out "composer require .....etc, etc". And in the vendor directory you will see the autoload.php file, and also a 'composer' directory, and, because you 'require'-d my php package, you will also see a 'gavinggordon' directory.

Anyways, just include the 'autoload.php' file, to be able to use my package, and any others that you have required via composer.

Sincerely,
Gavin Gordon Markowski

  6. Re: local install in linux of COMPOSER....   Reply   Report abuse  
Picture of OSWALDO OLEA OSWALDO OLEA - 2016-05-24 16:05:29 - In reply to message 5 from Gavin Gordon Markowski
hello Gavin,

I have done a local install of composer with the terminal command-line in a folder which I created named "assetinc" where I have put the folders of your package(src, test) in a linux system computer.

it created a file named "composer.phar" inside the folder "assetinc", then I looked for the composer.json file in your package, following the instructions on the composer "documentation basic usage" but didn't found one.

so then, I turned to your mail, and tried via the terminasl/console command-line "require [vendor]/[package]", but it does not find the command and didn't create the "vendor" folder....

I know I am provably making huge mistakes and misinterpretations in the procedure, but...... patience and help!