Sebastian Bergmann | 14 Jan 11:37 2012
Picon

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/

Wojtek O | 29 Sep 07:26 2011
Picon

assertIsSubset

Hi chaps,
I've just forked phpunit and added new assert for checking if a
$expected value is a subset of $actual.
Works with objects and arrays.

Make sense if you want to test you code but don't want to write 10
lines of assertEquals for individual fields.

example usage
{{{
$expected = array(
 'id' => 7,
 'nodes' => array(
  array('id' => 3),
  array('id' => 12),
 )
);
$actual = $myAPI->myCall();

$this->assertIsSubset($expected, $actual);
}}}

Whole idea is that your API might change over time (new fields in
response, ...) but this particular test doesn't care about whole
response. It's just checking if $actual variable meets the minimum
requirements.

What do you think? Can you see it useful?
I would love to hear some feedback.

(Continue reading)

Wojtek Oledzki | 28 Sep 20:16 2011

assertIsSubset

Hi chaps,
I've just forked phpunit and added new assert for checking if a
$expected value is a subset of $actual.
Works with objects and arrays.

Make sense if you want to test you code but don't want to write 10
lines of assertEquals for individual fields.

example usage
{{{
$expected = array(
 'id' => 7,
 'nodes' => array(
  array('id' => 3),
  array('id' => 12),
 )
);
$actual = $myAPI->myCall();

$this->assertIsSubset($expected, $actual);
}}}

Whole idea is that your API might change over time (new fields in
response, ...) but this particular test doesn't care about whole
response. It's just checking if $actual variable meets the minimum
requirements.

What do you think? Can you see it useful?
I would love to hear some feedback.

(Continue reading)

Nicolas Terray | 28 Sep 16:47 2011

Selenium PHP Support

Hi there,

I've read that the support of PHP in Selenium is deprecated. I would
like to know what this means with PHPUnit SeleniumTestCase for the future.

Thanks,
Nicolas Terray

PS: Maybe this has been already addressed, where can I read the archives
of this list?

Wojtek O | 28 Sep 10:33 2011
Picon

assertIsSubset

Hi chaps,
I've just forked phpunit and added new assert for checking if a
$expected value is a subset of $actual.
Works with objects and arrays.

Make sense if you want to test you code but don't want to write 10
lines of assertEquals for individual fields.

example usage
{{{
$expected = array(
 'id' => 7,
 'nodes' => array(
   array('id' => 3),
   array('id' => 12),
 )
);
$actual = $myAPI->myCall();

$this->assertIsSubset($expected, $actual);
}}}

Whole idea is that your API might change over time (new fields in
response, ...) but this particular test doesn't care about whole
response. It's just checking if $actual variable meets the minimum
requirements.

What do you think? Can you see it useful?
I would love to hear some feedback.

(Continue reading)

Wojtek Oledzki | 28 Sep 09:45 2011

assertIsSubset

Hi chaps,
I've just forked phpunit and added new assert for checking if a
$expected value is a subset of $actual.
Works with objects and arrays.

Make sense if you want to test you code but don't want to write 10
lines of assertEquals for individual fields.

example usage
{{{
$expected = array(
  'id' => 7,
  'nodes' => array(
    array('id' => 3),
    array('id' => 12),
  )
);
$actual = $myAPI->myCall();

$this->assertIsSubset($expected, $actual);
}}}

Whole idea is that your API might change over time (new fields in
response, ...) but this particular test doesn't care about whole
response. It's just checking if $actual variable meets the minimum
requirements.

What do you think? Can you see it useful?
I would love to hear some feedback.

(Continue reading)

Picon

one question about phpunit

Hi phpunit specialists,

When I designed tests through phpunit, One failure occurred. 
test file: testFile.php
one test function, for example testFunction1()
run: phpunit testFile.php

The line 49, 50, there are 2 assertion, they should be failed all, but the report only tell one, ignor the other.

also I see one option for phpunit --stop-on-failure, seems it does not work,
 though I assigned FALSE to stop-on-failure, (/usr/share/php/PHPUnit/TextUI/Command.php)

Are there any guys can help me? thank you very much.

Thanks,

Best Regards,
-----------------------------------------------------------------
Larry Shi(Shi Yao-Bin)
Open Source Program Office (EB-BAS-BECOM-BJ)
China Hewlett-Packard
yao-bin.shi <at> hp.com
------------------------------------------------------------------

Remi Collet | 7 Nov 08:43 2010

PHPUnit packages and PEAR (installer) minimal version required

Latest packages available in PHPUnit channel require PEAR installer >=
1.9.1.

I have made tests and don't encounter any issue with previous version.

Can you consider keeping this version as low as possible, and only raise
this when a bug in pear installer affects your packages ?

Why ?

For now, RHEL-6 (in RC stage) provides PEAR 1.9.0, and will probably
keep this version for the distro life, like RHEL-5 stay in 1.4.9 :(
(security bug, if discovered, will be backport without changing version)

We have a lot of PHPUnit package in EPEL repository for RHEL-6 (and for
the future clone, like CentOS 6), maintains by 3 packagers :

	php-phpunit-bytekit 1.1.1
	php-phpunit-DbUnit 1.0.0
	php-phpunit-File-Iterator 1.2.3
	php-phpunit-PHP-CodeCoverage 1.0.0
	php-phpunit-PHP-Timer 1.0.0
	php-phpunit-PHP-TokenStream 1.0.1
	php-phpunit-phpcpd 1.3.2
	php-phpunit-phpdcd 0.9.2
	php-phpunit-PHPUnit 3.5.3
	php-phpunit-PHPUnit-MockObject 1.0.1
	php-phpunit-PHPUnit-Selenium 1.0.0
	php-phpunit-Text-Template 1.0.0

(Continue reading)

David Harkness | 5 Nov 23:45 2010

Pull requests

Hi Sebastian (and anyone who has had a pull request accepted),

What steps should I take to submit a pull request that is likely to be accepted? I'm new to Git but think I've got the hang of it (mostly). I added two features to PHPUnit and PHP_CodeCoverage and submitted a request about three months ago:

1. Allow <at> covers annotations to specify files (detected by looking for a dot). The current directory and include path are searched for the file. The file is automatically added to the whitelist.

2. Allow <at> covers annotations to be added at runtime via $this->addCoveredElement($element).

We use these to allow for code coverage against view scripts (phtml). My HGM_Test_Zend_Case_View base class uses the name of the test class to locate the file and adds it as being covered. Since the view script files lack classes and methods, this works great without forcing the developer to specify the file manually for each test case.

I created the features against 3.5.0 and submitted a pull request. While they are separate commits, I submitted a single request because they were related and touched the same code paths. I did these in the master branch, but now I'm thinking it may have been better to create a feature branch. At the time, all tests passed, but since I didn't have vfsStream installed many were skipped. The other day I installed vfsStream and noticed that those skipped tests were in fact testing the <at> covers annotations. Oops! I have since updated my fork to the latest code, added tests specific to the <at> covers <file> feature, and made sure *all* tests pass.

What more can I do to get these features included? They seem useful to more than two or three other people, and the changes are fairly small. Please help as maintaining a private fork of the two projects and helping each developer manually install them instead of using PEAR is frustrating.

Thank you very much,
David

Remi Collet | 26 Sep 11:11 2010

Introduce myself and first question related to packaging

Hi,

I'm a fedora packager and I maintain a lot of php stuff in official 
repository (fedora and EPEL) [1]

Among this PHPUnit.

I also maintain a backport repository, mainly for LAMP stuff which is 
very usefull for Redhat / CentOS where official versions are quite 
outdated. [2]

I'm working on packaging the latest PHPUnit version for fedora.
So I have a few questions

- dbunit include PHP/CodeCoverage/Filter.php

But this is not added in the required package in the xml file

- dbunit include PHPUnit/Autoload.php

This means that dbunit requires PHPUnit, which seems ok for an extension 
of PHPUnit. But, according to the xml file, PHPUnit requires dbunit. 
This create a impossible to resolve circular dependency.

I understand than PHPunit requires all his extension to make install 
simpler for users. In this case, should an Autoload package be created ?

Regards
Remi.

[1] 
https://admin.fedoraproject.org/pkgdb/users/packages/remi?tg_paginate_limit=0
[2] http://rpms.famillecollet.com/

Martin Eisengardt | 13 Sep 10:47 2010
Picon

Broken pipes with process isolation <at> windows vista/ windows 7

Hi.

Do not know why, but sometimes phpunit or windows itself consequently messes up with pipes while process
isolation is activated. It shows up the following errors on some of our big projects (in this example 1 to 4
are regular test case errors):

PHPUnit 3.4.15 by Sebastian Bergmann.
.........................E..EE.................EEEEEEEEEEEEE 60 / 63 EEE Time: 26 seconds,
Memory: 12.00Mb There were 19 errors: [...]5) BGH_Core_Modules_ModuleDescriptorTest::testEquals
RuntimeException: Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE in
C:\dev\ws\r_p\bgh\bgh_php_lib\- on line 133 6)
BGH_Core_Modules_ModuleNameTest::testConstructor RuntimeException: Parse error: syntax error,
unexpected T_ENCAPSED_AND_WHITESPACE in C:\dev\ws\r_p\bgh\bgh_php_lib\- on line 133 7)
BGH_Core_Modules_ModuleNameTest::testNormal RuntimeException: Parse error: syntax error,
unexpected T_ENCAPSED_AND_WHITESPACE in C:\dev\ws\r_p\bgh\bgh_php_lib\- on line 133 8)
BGH_Core_Modules_ModuleNameTest::testToString RuntimeException: Parse error: syntax error,
unexpected T_ENCAPSED_AND_WHITESPACE in C:\dev\ws\r_p\bgh\bgh_php_lib\- on line 133 9)
BGH_Core_Modules_VersionTest::testConstructor RuntimeException: Parse error: syntax error,
unexpected T_ENCAPSED_AND_WHITESPACE in C:\dev\ws\r_p\bgh\bgh_php_lib\- on line 133 10)
BGH_Core_Modules_VersionTest::testConstructorMix RuntimeException: Parse error: syntax error,
unexpected T_ENCAPSED_AND_WHITESPACE in C:\dev\ws\r_p\bgh\bgh_php_lib\- on line 133 11)
BGH_Core_Modules_VersionTest::testStringConstructor RuntimeException: Parse error: syntax
error, unexpected T_ENCAPSED_AND_WHITESPACE in C:\dev\ws\r_p\bgh\bgh_php_lib\- on line 133 12)
BGH_Core_Modules_VersionTest::testNumericConstructor RuntimeException: Parse error: syntax
error, unexpected T_ENCAPSED_AND_WHITESPACE in C:\dev\ws\r_p\bgh\bgh_php_lib\- on line 133 13)
BGH_Core_Modules_VersionTest::testInvalidArguments RuntimeException: Parse error: syntax
error, unexpected T_ENCAPSED_AND_WHITESPACE in C:\dev\ws\r_p\bgh\bgh_php_lib\- on line 133 14)
BGH_Core_Modules_VersionTest::testEquals RuntimeException: Parse error: syntax error,
unexpected T_ENCAPSED_AND_WHITESPACE in C:\dev\ws\r_p\bgh\bgh_php_lib\- on line 133 15)
BGH_Core_Modules_VersionTest::testCompareTo RuntimeException: Parse error: syntax error,
unexpected T_ENCAPSED_AND_WHITESPACE in C:\dev\ws\r_p\bgh\bgh_php_lib\- on line 133 16)
BGH_Core_Modules_VersionTest::testCompareToInvalidArg RuntimeException: Parse error: syntax
error, unexpected T_ENCAPSED_AND_WHITESPACE in C:\dev\ws\r_p\bgh\bgh_php_lib\- on line 133 17)
BGH_Core_Modules_VersionTest::testEqualsStringArg RuntimeException: Parse error: syntax error,
unexpected T_ENCAPSED_AND_WHITESPACE in C:\dev\ws\r_p\bgh\bgh_php_lib\- on line 133 18)
BGH_Core_Modules_VersionTest::testEqualsInvalidStringArg RuntimeException: Parse error:
syntax error, unexpected T_ENCAPSED_AND_WHITESPACE in C:\dev\ws\r_p\bgh\bgh_php_lib\- on line 133
19) BGH_Core_Modules_VersionTest::testToString RuntimeException: Parse error: syntax error,
unexpected T_ENCAPSED_AND_WHITESPACE in C:\dev\ws\r_p\bgh\bgh_php_lib\- on line 133
FAILURES! Tests: 63, Assertions: 537, Errors: 19.  Writing
code coverage data to XML file, this may take a moment. Generating code coverage report, this may take a moment.

I changed the code in PHPUnit_Util_PHP a little bit to use a temprary file and not the pipe. That solved the
problem. But is is somehow strange since may be a phantom bug. I am starting phpunit.bat from within
eclipse. Restarting eclipse solves the problem for about one hour.

public static function runJob($job) { $fname = tempnam(getcwd(), 'phpunit_testcase_'); $testf =
fopen($fname, "w+"); fwrite($testf, $job); fclose($testf); $process = proc_open(
self::getPhpBinary(), self::$descriptorSpec, $pipes ); if (is_resource($process)) { //
fwrite($pipes[0], $job);fclose($pipes[0]); $stdout = stream_get_contents($pipes[1]);
fclose($pipes[1]); $stderr = stream_get_contents($pipes[2]); fclose($pipes[2]);
proc_close($process); unlink($fname); return array('stdout' => $stdout, 'stderr' => $stderr); }
unlink ($fname); }

Ciao
Martin


Gmane