Sebastian Bergmann | 14 Jan 11:37
Picon
Gravatar

The mailinglist will be discontinued

 Hello!

 The mailserver that is used to serve this mailinglist will soon be
 retired by Tobias Schlitt, who graciously donated it for the last couple
 of years.

 As the traffic on the PHPUnit mailinglists is not anymore what it used
 to be, I decided to discontinue them in favour of IRC, Twitter,
 StackOverflow, etc.

 Best,
Sebastian

--

-- 
Sebastian Bergmann                    Co-Founder and Principal Consultant
http://sebastian-bergmann.de/                           http://thePHP.cc/

David Harkness | 10 Jan 18:32

Re: PhpUnit on Windows

If that is your real code, you are extending the wrong class that doesn't exist. It must read

.... extends PHPUnit_Framework_TestCase

On Jan 10, 2012 9:24 AM, "Voronetskyy Yevgen" <voronetskyy <at> gmail.com> wrote:

I'm novice in PHP programming...

Below the code of my test class:

<?php

require_once 'PHPUnit.php';

class ValidateTest extends PHPUnit_TestCase
{
    // contains the object handle of the string class
    var $abc;

    // constructor of the test suite
    function ValidateTest($name) {

       $this->PHPUnit_TestCase($name);
    }

    // called before the test functions will be executed
    // this function is defined in PHPUnit_TestCase and overwritten
    // here
    function setUp() {
        // create a new instance of String with the
        // string 'abc'
        $this->abc = 'abc';
    }

    // called after the test functions are executed
    // this function is defined in PHPUnit_TestCase and overwritten
    // here
    function tearDown() {
        // delete your instance
        unset($this->abc);
    }

    // test the toString function
    function testToString() {
        $result = $this->abc->toString('contains %s');
        $expected = 'contains abc';
        $this->assertTrue($result == $expected);
    }

    // test the copy function
    function testCopy() {
      $abc2 = $this->abc->copy();
      $this->assertEquals($abc2, $this->abc);
    }

  }
?> 



On Jan 10, 2012, at 7:18 PM, Jeremy Cook wrote:

> Hi,
>  
> Are you definitely extending PHPUnit_...

Voronetskyy Yevgen | 10 Jan 17:54
Picon

PhpUnit on Windows

Hi,

I'm novice in PHP.
I've installed the PHPUnit with Pear.
When I run the following command from CLI : phpunit --help , I see the correct help message from PHPUnit.

But when I give the argument which is a TestCase file or a folder with tests, there is nothing. Any errors. Nothing.

Could you help me to figure out what is wrong with my PhpUnit?

Thanks in advance,
Yevgen
Motyka, Axel | 6 Jan 10:01
Picon

phpUnit with eclipse and PTI

Hi there,

 

i hope i can find some help here!

 

Iam trying to use phpunit with the PHP Tools Integration(PTI) – i know this is not a PTI mailing list. But maybe someone can help me.

 

I installed the PTI package – everytime i try to execute phpunit (or any other PHP Tool like copy paste detector) i get :

Fatal error: Class 'ezcConsoleInput' not found in C:\IDE\eclipse\plugins\org.phpsrc.eclipse.pti.library.pear_1.2.2.R20111119000000\php\library\PEAR\PHPCPD\TextUI\Command.php on line 62

 

Seems to be a mistake in my configuration!

 

I am using Windows 7 with eclipse Indigo Service Release 1.

 

Thanks for your help!

 

Galen Wright-Watson | 30 Dec 09:04
Picon
Gravatar

Problem installing PHPUnit via pear: HTTPS connection refused

The short version: when trying to install any package via the phpunit
pear channel, it fails on my computer:

> $ sudo pear install phpunit/PHPUnit
> Connection to `pear.phpunit.de:443' failed: Connection refused

Details:

I was performing an initial (and successful) install of some phpunit
packages. A short time later, I updated the channel. After that, all
attempts to install additional packages resulted in the above error.

None of the following have an affect on the error:

* Removing and adding the channel.
* Updating the channel (with the update-channels or channel-update
pear commands)
* Clearing the pear cache in combination with the above.

I can't access https://pear.phpunit.de from my computer; the
connection attempt is rejected almost immediately. DownForEveryone's
HTTPS checker (http://www.downforeveryone.com/downforeveryone-https/)
also reports the site as "down".

Is this something that needs to be fixed by the site admins? Is there
anything I can do to fix or work around the error to install phpunit
packages via pear? For example, can I change the server that pear
accesses, or force pear to use HTTP rather than HTTPS, or downgrade
the channel? So far, I haven't been able to find anything relevant in
the pear or PHPUnit documentation, or in web searches at large.

System: OSX 10.6.8, PHP 5.3.6 (Apple's build), PEAR 1.9.4.

Let me know if any additional information is needed. Thanks for your
consideration.

Demian Katz | 21 Dec 21:09
Favicon

"Aborted" when requesting coverage

First of all, I’m a new list member, and I couldn’t find a searchable archive, so apologies if I’m asking a duplicate question.  Feel free to point me in the right direction if I’m missing something obvious.

 

My problem is that PHPUnit is refusing to export coverage reports for me.  When I run my tests with no coverage parameters, they work fine.  When I try --coverage-clover or --coverage-html parameters, PHPUnit dies with the simple message:

 

Aborted

 

Turning on verbose mode with the –v switch makes no difference.  All I get is the word “Aborted,” which is not very helpful for troubleshooting!

 

I’m experiencing this problem on two different servers:

 

Server 1: Ubuntu, PHP 5.3.2, PHPUnit 3.5.15

Server 2: RedHat, PHP 5.3.8, PHPUnit 3.6.5

 

Any idea what’s going wrong or how I could start narrowing down the cause?

 

thanks,

Demian

Favicon

similar problem as 84.le0n | 11 Dec 15:39

Upgraded to 3.6 on Debian
running phpunit gives me the error :
Call to undefined method PHP_CodeCoverage_Filter::getInstance() at line 39

I upgraded to get the coverage back after upgrading to Jenkins 1.443

--
Stéphane

84.le0n | 11 Dec 15:39
Picon

Issue upgrading PHPUnit from 3.5 to 3.6

Hi all, this is my first mail on this list hoping you can help me
correcting an upgrading issue from 3.5 to 3.6 ;)

I work on joomla-platform project and PHPUnit is used to test the code.

My issue is that I've upgraded a working PHPUnit 3.5 to 3.6 (as
requested for project) on my macbook and it gives me fail on phpunit.

This is my working starting point:
PHPUnit-3.5.15
PHP 5.3.8
PEAR 1.9.3
XDebug 2.1.2
pear.phpunit.de/DbUnit 1.0.0
pear.phpunit.de/File_Iterator 1.2.3
pear.phpunit.de/Text_Template 1.0.0
pear.phpunit.de/PHP_CodeCoverage 1.0.2
pear.phpunit.de/PHP_Timer 1.0.0
pear.phpunit.de/PHPUnit_MockObject 1.0.3
pear.phpunit.de/PHPUnit_Selenium 1.0.1
pear.symfony-project.com/YAML 1.0.2

PEAR was installed with go-pear.phar file, PHP and XDebug were
installed from macport.

This configuration works perfectly for me, now these are the steps I
do to trying to upgrade PHPUnit and its dependencies:
"sudo pear upgrade PEAR"
tell me
"Nothing to upgrade"

Then I've configured
"sudo pear config-set auto_discover 1"
and after
"sudo pear install pear.phpunit.de/PHPUnit"
that ends with these messages

install ok: channel://pear.phpunit.de/File_Iterator-1.3.0
install ok: channel://pear.phpunit.de/Text_Template-1.1.1
install ok: channel://pear.phpunit.de/PHP_Timer-1.0.2
install ok: channel://pear.symfony-project.com/YAML-1.0.6
install ok: channel://pear.phpunit.de/PHP_TokenStream-1.1.1
install ok: channel://pear.phpunit.de/PHP_CodeCoverage-1.1.1
install ok: channel://pear.phpunit.de/PHPUnit_MockObject-1.1.0
install ok: channel://pear.phpunit.de/PHPUnit-3.6.4

It seems that all was upgraded correctly, but when I call "phpunit" it
gives me this error:

PHP Fatal error: Call to undefined method
PHP_CodeCoverage_Filter::getInstance() in /opt/local/bin/phpunit on
line 39
PHP Stack trace:
PHP 1. {main}() /opt/local/bin/phpunit:0

It's the third time I upgrade and I receive same error, I've searched
but I haven't find solution.

Can someone help me ?
Do you know how can I solve?

Unique solution for me that actually works is downgrade to PHPUnit 3.5
version, but I'm locked to this version :( !

Sorry for my long email,
Eng. Gabriele Pongelli

Mike Howells | 5 Nov 05:08

Problems with: phpunit <directory>

When I run phpunit specifying a directory (calledunittests) of test cases I get the following fatal exception - anyone know whats going on...?

C:\Users\mho\workspace\myproject> phpunit unittests

PHP Fatal error:  Uncaught exception 'PHPUnit_Framework_Exception' with message 'Neither "unittests.php" nor "unittests.php" could be opened.' in C:\wamp\bin\php\php5.3.4\pear\PHPUnit\Util\Skeleton\Test.php:100

Stack trace:   

#0 C:\wamp\bin\php\php5.3.4\pear\PHPUnit\TextUI\Command.php(153): PHPUnit_Util_Skeleton_Test->__construct('unittests', '')

#1 C:\wamp\bin\php\php5.3.4\pear\PHPUnit\TextUI\Command.php(126): PHPUnit_TextUI_Command->run(Array, true)

#2 C:\wamp\bin\php\php5.3.4\phpunit(46): PHPUnit_TextUI_Command::main()

#3 {main}

  thrown in C:\wamp\bin\php\php5.3.4\pear\PHPUnit\Util\Skeleton\Test.php on line 100

Fatal error: Uncaught exception 'PHPUnit_Framework_Exception' with message 'Neither "unittests.php" nor "unittests.php" could be opened.' in C:\wamp\bin\php\php5.3.4\pear\PHPUnit\Util\Skeleton\Test.php on line 100

PHPUnit_Framework_Exception: Neither "unittests.php" nor "unittests.php" could be opened. in C:\wamp\bin\php\php5.3.4\pear\PHPUnit\Util\Skeleton\Test.php on line 100

Call Stack:

    0.0004     631040   1. {main}() C:\wamp\bin\php\php5.3.4\phpunit:0

    0.0079    1139224   2. PHPUnit_TextUI_Command::main() C:\wamp\bin\php\php5.3.4\phpunit:46

    0.0079    1139808   3. PHPUnit_TextUI_Command->run() C:\wamp\bin\php\php5.3.4\pear\PHPUnit\TextUI\Command.php:126

    0.1023    2232768   4. PHPUnit_Util_Skeleton_Test->__construct() C:\wamp\bin\php\php5.3.4\pear\PHPUnit\TextUI\Command.php:153

Hannes Papenberg | 26 Oct 17:59
Gravatar

Issue generating skeleton classes

Hi folks,
I'm trying to generate skeleton classes from the code of the Joomla
framework and ran into issues. Basically, the script stops without doing
anything  for several files of the code base and I tried it with several
different ways. I also traced it to one line of the code of phpunit.
Maybe you can help? Here is what I did:

I ran "phpunit --skeleton-test JUpdater updater.php" in the folder where
this file resides. The file is attached to this post. PHPUnit starts and
then terminates directly again and the only output is this:
# phpunit --skeleton-test JUpdater updater.php
PHPUnit 3.5.15 by Sebastian Bergmann.

^Notice the empty line above

I was able to trace it to /PHPUnit/TextUI/Command.php line 711, where it
fails without throwing an error or doing anything. That line contains
the following on my installation:
$skeleton = $reflector->newInstanceArgs($args);

My install is PHPUnit 3.5.15 on PHP 5.3.8, Apache 2.2.21 on Win7x64.

When using Netbeans to generate a range of skeleton test files, dozens
if not even hundreds of my files get skipped. Am I missing something
here? Does it fail because of missing parent classes of the class to
generate skeletons for?

I would be glad if you could help. Thanks!

Hannes

getDBO(); $retval = false; // Push it into an array if (!is_array($eid)) { $query = 'SELECT DISTINCT update_site_id, type, location FROM #__update_sites WHERE enabled = 1'; } else { $query = 'SELECT DISTINCT update_site_id, type, location FROM #__update_sites' . ' WHERE update_site_id IN' . ' (SELECT update_site_id FROM #__update_sites_extensions WHERE extension_id IN ('. implode(',', $eid) . '))'; } $dbo->setQuery($query); $results = $dbo->loadAssocList(); $result_count = count($results); for ($i = 0; $i setAdapter($result['type']); if (!isset($this->_adapters[$result['type']])) { // Ignore update sites requiring adapters we don't have installed continue; } $update_result = $this->_adapters[$result['type']]->findUpdate($result); if (is_array($update_result)) { if (array_key_exists('update_sites', $update_result) && count($update_result['update_sites'])) { $results = JArrayHelper::arrayUnique(array_merge($results, $update_result['update_sites'])); $result_count = count($results); } if (array_key_exists('updates', $update_result) && count($update_result['updates'])) { for ($k = 0, $count = count($update_result['updates']); $k find( array( 'element' => strtolower($current_update->get('element')), 'type' => strtolower($current_update->get('type')), 'client_id' => strtolower($current_update->get('client_id')), 'folder' => strtolower($current_update->get('folder')) ) ); $eid = $extension ->find( array( 'element' => strtolower($current_update->get('element')), 'type' => strtolower($current_update->get('type')), 'client_id' => strtolower($current_update->get('client_id')), 'folder' => strtolower($current_update->get('folder')) ) ); if (!$uid) { // Set the extension id if ($eid) { // We have an installed extension, check the update is actually newer $extension->load($eid); $data = json_decode($extension->manifest_cache, true); if (version_compare($current_update->version, $data['version'], '>') == 1) { $current_update->extension_id = $eid; $current_update->store(); } } else { // A potentially new extension to be installed $current_update->store(); } } else { $update->load($uid); // if there is an update, check that the version is newer then replaces if (version_compare($current_update->version, $update->version, '>') == 1) { $current_update->store(); } } } } $update_result = true; } elseif ($retval) { $update_result = true; } } return $retval; } /** * Multidimensional array safe unique test * * <at> param array $myArray The source array. * * <at> return array * * <at> deprecated 12.1 * <at> note Use JArrayHelper::arrayUnique() instead. * <at> note Borrowed from PHP.net * <at> see http://au2.php.net/manual/en/function.array-unique.php * <at> since 11.1 * */ public function arrayUnique($myArray) { JLog::add('JUpdater::arrayUnique() is deprecated. See JArrayHelper::arrayUnique().', JLog::WARNING, 'deprecated'); return JArrayHelper::arrayUnique($myArray); } /** * Finds an update for an extension * * <at> param integer $id Id of the extension * * <at> return mixed * * <at> since 11.1 */ public function update($id) { $updaterow = JTable::getInstance('update'); $updaterow->load($id); $update = new JUpdate; if ($update->loadFromXML($updaterow->detailsurl)) { return $update->install(); } return false; } }

Ciara Conlon | 17 Oct 14:04
Picon

Phpunit Newbie: Run tests in parallel

Does phpunit support running tests in parallel?

I am using PHPUnit SeleniumTestCase extention to test our web 
application. However each test is being run in isolation which means 
that i would have to put a login and logout in every test case, which 
seems like a bit of waste, also it will triple the time it takes to run 
my suite and take up a load more memory.

Is there a way around this? ie. I want to run a login test, then for 
example edit the users account details, then a logout test. I want each 
test to store its own result but run in a single session.

-- 
Kind Regards,

Ciara Conlon
Application Support and Development
IE Domain Registry Limited

Tel: (01) 2365410
Email: ciarak <at> iedr.ie
WWW: http://iedr.ie

Registered Office: IE Domain Registry, Harbour Square, Fourth Floor, Dun Laoghaire, Co. Dublin.
Registered in Ireland. No: 315315.
-------------------------------------------------------------------------------
The enclosed document is CONFIDENTIAL to addressee and IE Domain Registry Ltd.
The intended addressee is NOT AUTHORISED to copy, distribute, disclose or
otherwise use the information disclosed. Please also note that this information
should not be edited or redistributed in any way.
--------------------------------------------------------------------------------


Gmane