PHPUnit is the de facto standard for writing unit tests for PHP code.
0
votes
0answers
20 views
PHPUnit throwing error when not executed as rute
I have installed PHPunit via Pear, as well as PHP 5.4.11. I have google'd my solution, which led to other pages on stackoverflow, none of which were able to resolve my issue. I'm sorry that I cannot ...
1
vote
1answer
18 views
PHPUnit - testing function which uses realpath()
I have a function that checks if user supplied filename is under the /opt/ directory.
It uses realpath so users can't pass in something like '../etc/passwd' for security reasons.
function ...
0
votes
0answers
13 views
PHPUNIT running on selenium server
I am trying to get an array of elements using xpath and load the results into an array and then perform assertCount(). Here is the code I that I have. I am new to this and I am not sure why ...
1
vote
0answers
16 views
Test access_control in Symfony2
I want to test that my access_control is working as expected, that certain roles don't have access to a page while other roles do.
I can do this using Functional Tests, logging in each user and ...
-1
votes
0answers
12 views
Error: Database connection “Mysql” is missing, or could not be created. bake on Windows
So i have a xampp v3.1.0 server on my windows 7 64bit and i am trying to bake using CMD. Now i set the path for cake and it works properly with "cake bake" command. but when i want to start it gives ...
0
votes
0answers
21 views
How to zend 2 unit test a select query take argument as Closure
I'm new with php unit and Zend 2.
I need to write unit test for the function below:
public function getMyList($limitDay)
{
// build time
$limitTime = strtotime("-".$limitDay." day"); ...
0
votes
0answers
11 views
phpunit getMockFromWsdl accepts any non-valid wsdl file
Basically I have no access to a call being made to my SoapServer. To see if it functions like I want it to, I've tried to create a test for it. I have no idea how the call should be made, as the wsdl ...
0
votes
1answer
17 views
I can't get PHPUnit to run - Failed opening required 'SebastianBergmann/Diff/autoload.php'
I installed PHPUnit via pear and I brought uploaded the required PHP files into the account.
I setup php.ini with every possible include path I could imagine...I know it is using the proper php.ini ...
0
votes
0answers
10 views
Add constant to a mock in PHPUnit
Is it possible to add a class constant to a mock using PHPUnit?
Here an example:
class SomeTest extends PHPUnit_Framework_TestCase {
public function setUp() {
$mock = $this->getMock( ...
0
votes
2answers
26 views
PHPUnit Sellenium 2 extension setting cookies
I'm trying to set cookies before test but for some reason they are not set. Here is my example code:
class WebTest extends PHPUnit_Extensions_Selenium2TestCase
{
protected function setUp()
{
...
0
votes
1answer
21 views
Yii: Fixtures And Setup() In Unit Test
I hope someone can help me. I installed and tried to use phpunit. It Works well but now i tried to use fixtures and the setUp method and it doesn't work.
class RightGroupTest extends CDbTestCase {
...
0
votes
2answers
23 views
PHPUnit testing individually in Symfony
I would like to run some unit Tests individually with PHPUnit, but I have certain classes separated from the Tests, since I am using the symfony framework, and I group the Tests and the Classes in ...
1
vote
1answer
27 views
Unit test Abstract class method that calls concrete child method
I have an abstract class that has an abstract method and a concrete method.
The concrete method calls the abstract method and uses its return value.
How can this return value be mocked?
So the ...
0
votes
2answers
30 views
Mock an internal function call of current class under test
I want to test this function:
public function reset()
{
if(!$this->onBeforeReset()) // Protected, internal method
{
return false;
}
// Continue with tests
}
I'd ...
1
vote
0answers
15 views
Yii Framework - How to run functional test case in background with phpunit/selenium2
I am developing a application with the functional (with phpunit/selenium2) test case. I have to attached the pre-commit hook to a functional testing. So when ever i try to commit something it opens ...
5
votes
1answer
54 views
Class __PHP_Incomplete_Class has no unserializer
I am trying to run the tests in PHPUnit and getting this error.
Fatal error: Uncaught exception 'ErrorException' with message 'Class
__PHP_Incomplete_Class has no unserializer' in ...
1
vote
1answer
19 views
How mock new object in method - phpunit
I'm testing php code with phpunit and I have a problem:
I'm testing class:
class ClassName
{
public function MethodName()
{
// something
$objectName = new Object();
$variableName = ...
0
votes
0answers
14 views
PHPUnit Database testing doesnt fully run the function to test
I have a PHPUnit test case that test a function that does a range of manipulation with the MySQL database.
When I run the test via PHPUnit the function is not fully run, MySQL database is failed to ...
0
votes
1answer
12 views
Can't locate file despite given path
I have a problem with the path of a certain file. I want to include a file in my phpunit test. In our central repository it is located here:
include 'secure\functions.php';
However I get an error ...
4
votes
1answer
48 views
PDO connection is not closed when phpunit is running with symfony 2.X
We have about 180 unit tests implement webtestcase class and tests are running over controllers.
However when we run the unit tests, they open too many connection to db. Because of too many active ...
0
votes
1answer
52 views
Functional testing clickAndWait not working
I am writing web application in yii with the phpunit selenum testing here is my test case for the login form
public function testHasLoginForm()
{
$this->open('site/login');
...
0
votes
1answer
27 views
Zend Framework 2 remove hard coded path from unit test
I'm just going through the Zend Framework 2 unit test tutorial. During the process of setting up the unit test they insert a hard coded path to the application config in the setUp method:
namespace ...
0
votes
1answer
13 views
How can i get html headers with phpunit using Selenium2?
public function testheaders()
{
$url=$this->url('http://www.example.com/index.php');
$kur = get_headers($url);
var_dump($kur);
}
I got the error : get_headers(): ...
0
votes
0answers
95 views
+50
PHPUnit: Fatal error Class ClassName not found
I'm trying to build a Unit Testing environment for a CodeIgniter application. I'm following this book and got PHPUnit to work.
I'm at a point where I'm testing some code in a model:
public ...
0
votes
0answers
13 views
PHPUnit and Zend Framework 2 - try to test a controller helper method: no tests were executed
I am trying to test a method of the IndexController of the application module, more precisely IndexController->translateKey(keyString, localeString), which will return the corresponding value as a ...
0
votes
0answers
23 views
Phpunit password comparison
I would like to test a login function that one of the developers produced. What I would like to do is have test-users be created in my setUp and then I would like to use these users to test the login ...
1
vote
1answer
48 views
PHP Unit Testing and Mocking with Mockery
This could be a misunderstanding from my side about mocking, and would really appreciate an explanation on how is mocking an inexistent or existent class is a good thing ?
Example Scenario: Say we ...
0
votes
2answers
44 views
Unit test for login action (PHPUnit + Zend Framework 1.11)
I am trying to test my login controller and this is what i have written so far:
public function testValidUserIsredirectedToIndex()
{
$this->dispatch('/index/logincra');
$this->resetResponse();
...
0
votes
1answer
36 views
PHPUnit : assertInstanceOf() not working
I need to check if a variable is an object of the User type.
User is my class
$user my object
$this->assertInstanceOf($user,User);
This is not working , i have a use of undefined constant User - ...
0
votes
1answer
41 views
PhpQuery problems with changing the value with val()
I got a HTML table that looks like this:
<table id="xp">
<tbody >
<tr>
<td>
<input type="text" ...