62156

PHPUnit_Framework_TestCase class is not available. Fix… - Makegood , Eclipse

I am working in OSX 10.11

I am trying to setup PHPUnit , MAKEGood and Xdebug with Eclipse .

XDebug is Done . I can Run PHPUnit tests form the console .

But now configuring MakeGood is lot more harder than i expected .

MY PHP Executables

<img src=https://www.e-learn.cn/content/wangluowenzhang/"https://i.stack.imgur.com/sdHDG.png" alt="enter image description here">

Do i have to add pear in Eclipse->Preferences->PHP->Libraries ?? i am not sure because i installed PHPUnit using Brew.

brew install homebrew/php/phpunit

But again i tried to include PEAR .

I gave the path as usr/local/bin because when i try which pear in terminal it will output as

/usr/local/bin/pear

<img src=https://www.e-learn.cn/content/wangluowenzhang/"https://i.stack.imgur.com/i26Rq.png" alt="enter image description here">

And in my project properties under PHP-> include path i added the above PEAR library .

still from Makegood the error comes as

PHPUnit_Framework_TestCase class is not available. Fix..

I tried a lot of things , Ex:-

reinstalling pear rm .metadata/.plugins/org.eclipse.dltk.core.index.sql.h2/* restart Eclipse Restart Computer change pear library path

Actually i am not sure what i am doing wrong . Even i am not sure i need the pear library .

Any help is appreciated . Thanks in advance .

Answer1:

MakeGood and Composer need some fiddling to get them to work see

    <li>https://github.com/piece/makegood/issues/17</li> <li>https://github.com/piece/makegood/issues/85</li> </ul>

    You might want to

    <ol> <li>install phpunit with composer </li> <li>add a file MakeGoodPreload.php as your Preload Script in the MakeGood configuration.</li> <li>add phpunit.xml</li> </ol>

    More recent PHPUnit releases are optionally done with composer.

    First install composer:

    curl -sS https://getcomposer.org/installer | php

    See https://phpunit.de/manual/current/en/installation.html

    then install phpunit

    php composer.phar require "phpunit/phpunit=4.8.*"

    now test from the command line

    vendor/phpunit/phpunit/phpunit.php test/MakeGoodTest.php

    using the MakeGoodTest.php file below. The result should be:

    PHPUnit 4.8.21 by Sebastian Bergmann and contributors. Warning: Deprecated configuration setting "strict" used . Time: 86 ms, Memory: 4.50Mb OK (1 test, 5 assertions)

    Recent MakeGood releases support the user of the composer installed phpunit.

    In your Eclipse project create a project "makegood" that contains your composer installation, test/MakeGoodTest.php, MakeGoodPreload.php and phpunit.xml.

    Right click properties of the project and go to the "MakeGood" tab. in the PHPUnit tab add phpunit.xml and in the General Tab set the Preload Script to MakeGoodPreload.php.

    Now you should be able to open MakeGoodTest.php in the editor and right click to get "Run Tests in class ...".

    running it should give you:

    PHPUnit 4.8.21 by Sebastian Bergmann and contributors. Warning: Deprecated configuration setting "strict" used . MakeGood [x] [32mPush and pop[39m Time: 192 ms, Memory: 8.75Mb OK (1 test, 5 assertions)

    <strong>phpunit.xml</strong>

    <phpunit backupGlobals="true" backupStaticAttributes="false" cacheTokens="false" colors="false" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" forceCoversAnnotation="false" mapTestClassNameToCoveredClassName="false" printerClass="PHPUnit_TextUI_ResultPrinter" processIsolation="false" stopOnError="false" stopOnFailure="false" stopOnIncomplete="false" stopOnSkipped="false" testSuiteLoaderClass="PHPUnit_Runner_StandardTestSuiteLoader" strict="false" verbose="false"> </phpunit>

    <strong>MakeGoodPreload.php</strong>

    <?php // This is a preload script to be used with // the Eclipse makegood continuous integration plugin // see https://github.com/piece/makegood/releases error_reporting(E_ALL); $loader = require 'vendor/autoload.php';

    <strong>test/MakeGoodTest.php</strong>

    <?php class MakeGoodTest extends PHPUnit_Framework_TestCase { public function testPushAndPop() { $stack = array(); $this->assertEquals(0, count($stack)); array_push($stack, 'foo'); $this->assertEquals('foo', $stack[count($stack)-1]); $this->assertEquals(1, count($stack)); $this->assertEquals('foo', array_pop($stack)); $this->assertEquals(0, count($stack)); } } ?>

Recommend

  • My Application can't start debug mode in Android Stduio
  • How to use a huge array in HLSL (error X4505)
  • Symfony2 - Composer class loader instance in controller
  • css active on html inside php echo doesn't stay when click is left
  • HABTM associations in Rails : collecting and counting the categories of a model's children
  • Plotting A Hyperboloid
  • Extjs, handling success or failure when doing a standard submit in a form
  • How can I have equal heights for inner elements of flexbox grid/boxes/cards without using jQuery?
  • Contact form problem - I do receive messages, but no contents (blank page)
  • How to change default stop edit behavior in jtable
  • Run EF6 Query in separate Thread on WinForm Button Click Event
  • RabbitMQ java client stops consuming messages
  • Adding independent aspx/asmx pages into DotNetNuke
  • Merge Module leaving files during uninstall
  • Avoid registering duplicate broadcast receivers in Android
  • Deploying a CodeRush plugin from the Community Site
  • xtable - background colour of added rows
  • Symfony2 - Doctrine - no changeset in post update
  • How can I make this modal persistent?
  • How to 'create temp table as select' in Slick?
  • Lock Horizontal View
  • Find group of records that match multiple values
  • JqueryMobile Popup menu is not working
  • pyodbc doesn't report sql server error
  • gspread or such: help me get cell coordinates (not value)
  • Eloquent paginate function in Slim 3 project using twig
  • Custom Tabgroup Appcelerator
  • Meteor helpers not available in Angular template
  • PHPUnit_Framework_TestCase class is not available. Fix… - Makegood , Eclipse
  • Projection media query: browser support and workarounds?
  • Different response to non-authenticated users and AJAX calls
  • PHP - How to update data to MySQL when click a radio button
  • Counter field in MS Access, how to generate?
  • Sony Xperia Z Tablet not found by adb
  • Rearranging Cells in UITableView Bug & Saving Changes
  • R: gsub and capture
  • Proper way to use connect-multiparty with express.js?
  • Benchmarking RAM performance - UWP and C#
  • Conditional In-Line CSS for IE and Others?
  • Net Present Value in Excel for Grouped Recurring CF