phpunit

escaping into php

$valid-url = "p1=".rawurlencode($_GET['p1'])."&type=".rawurlencode($_GET['type'])."&os=".rawurlencode($_GET['os'])."&price=".rawurlencode($_GET['price'])."&sort=".rawurlencode($_GET['sort'])."&sort_order=".rawurlencode($_GET['sort_order'])."&perpage=".rawurlencode($perpage).""; i am trying to build the url and pass it to <a href=''..b...

TDD and encapsulation priority conflict

Hi, I just started practicing TDD in my projects. I'm developing a project now using php/zend/mysql and phpunit/dbunit for testing. I'm just a bit distracted on the idea of encapsulation and the test driven approach. My idea behind encapsulation is to hide access to several object functionalities. To make it more clear, private and prote...

PHPUnit installed but class PHPUnit_TestCase not found

Talk about falling at the first hurdle. My test script: <?php require_once('PHPUnit/Framework.php'); class TransferResponseTest extends PHPUnit_TestCase { ... } Running my test case: $ phpunit TransferResponseTest Fatal error: Class 'PHPUnit_TestCase' not found in /Volumes/Data/greg/code/syndicate/tests/TransferResponseTest...

why this sql not working?

I have a query public static function TestQuery( $start=0, $limit=0){ $sql = " SELECT count(*) AS total FROM db.table1 JOIN db.table2 ON table1.fieldID = {$fieldID} AND table2.assigned = 'N'"; $qry = new SQLQuery; $qry->query($sql); if($row = $qry->fetchRow()){ $total = intval($row->total); } ret...

How do I configure and use PHPunit with Hudson?

How do I configure CI hudson with PHPunit and how do I run phpunit using hudson? ...

phpUnderControl and CodeBrowser

Does phpUnderControl have a built in code browser? If so, how do I change it to use PHP_CodeBrowser instead? ...

How do I configure CI hudson with PHPunit and how do I run phpunit using hudson?

Hi, I am getting following error mentioned below. Help is much needed for this... kindly go through the errors. Started by an SCM change Updating https://suppliesguys.unfuddle.com/svn/suppliesguys_frontend2/Frontend-Texity/src U sites\all\modules\print\print_pdf\print_pdf.pages.inc At revision 1134 [workspace] $ sh -xe C:\WIND...

Packaging PHPUnit tests as a PHAR archive?

Is it possible to package PHPUnit tests as a PHAR archive, and run them using phpunit? I've created a .phar with the follow script: <?php $cPhar = new Phar('mytests-archive.phar', 0); $cPhar->addFile('mytest.php'); $sStub = <<<ENDSTUB #! /usr/bin/php <?php Phar::mapPhar('mytest-archive.phar'); require 'phar://mytests-archive.phar/myte...

Is it possible to run PHPUnit with a dynamically loaded extension library?

I have a suite of PHPUnit tests for my extension, and I want to run them as part of the extension's Hudson build process. So I want to run PHPUnit specifying the extension library to load at runtime, but I can't figure out how to do this. My directory structure is as follows: /myextension.c /otherextensionfiles.* /modules/myextension....

POST parameters to PHPUnit test

Hi Guys! I'm new on testing, I'm using PHPUnit to write test. All the site has been designed using the MVC pattern. I would like to test each method on my controllers, the problem is that such methods receives the parameters though the $_POST variable. How can I overwrite this variable? Thanks in advance Alejandra ...

Robust unit-testing of HTML in PHP

I'm adding unit-tests to an older PHP codebase at work. I will be testing and then rewriting a lot of HTML generation code and currently I'm just testing if the generated strings are identical to the expected string, like so: (using PHPUnit) public function testConntype_select() { $this->assertEquals( '<select><option value=...

How to exclude file from PHPUnit test suite in xml config?

I have following, very simple, XML config for PHPUnit: <phpunit bootstrap="/_tests/TestAutoload.php"> <testsuites> <testsuite name="Unit Tests"> <directory suffix=".php">_tests</directory> </testsuite> </testsuites> </phpunit> How to exclude certain file in this directory from test suite? I tried <e...

Separate seeds in PHPUnit

How do I create a separate seed for some test inside one test class? PHPUnit documentation includes this example <?php require_once 'PHPUnit/Extensions/Database/TestCase.php'; class DatabaseTest extends PHPUnit_Extensions_Database_TestCase { protected function getConnection() { $pdo = new PDO('mysql:host=localhost;dbna...

Unit Testing-- fundamental goal?

Me and my co-workers had a bit of a disagreement last night about unit testing in our PHP/MySQL application. Half of us argued that when unit testing a function within a class, you should mock everything outside of that class and its parents. The other half of us argued that you SHOULDN'T mock anything that is a direct dependancy of the ...

What is the best way to assert redirections in Selenium?

I am writing a selenium test and I need to assert that the page is redirected. How should I verify this? What would be the best way? I am using PHPUnit and the PHPUnit_Extensions_SeleniumTestCase. ...

PHPUnit + Maven for PHP - setUpBeforeClass() not called

When running the "mvn test" command, the PHPUnit tests are run. The problem I have is that the setUpBeforeClass() method within a test class is not called when running the tests from maven. Does anybody know the problem? I use the last version of PHPUnit (3.3.9) available on repositories. ...

should one use phpunit or lime with symfony?

i just wonder, should one use symfony's lime or phpunit for testing? what are the pros and cons with each one? thanks ...

selenium vs phpunit/lime?

i have seen the power of selenium and that it can give you the tests in different languages. so the question is, why should i use phpunit or lime (for symfony) when a solution like selenium is available? isn't it time-consuming to write all the tests by hand, when you can just use selenium? thanks. ...

Cannot redeclare class error when generating PHPUnit code coverage report

Starting a project with Zend Framework 1.10 and Doctrine 2 (Beta1). I am using namespaces in my own library code. When generating code coverage reports I get a Fatal Error about Redeclaring a class. To provide more info, I've commented out the xdebug_disable() call in my phpunit executable so you can see the function trace (disabled loc...

Selenium: How to select an option from a select menu?

I am writing a Selenium test in PHP using the PHPUnit Selenium extension. I know how to type something into a text field: $this->type('fieldName', 'value'); But how do I select an option from a drop-down menu? ...