phpunit

PHPUnit Segmentation fault

本秂侑毒 提交于 2019-12-18 11:19:35
问题 When a PHPUnit test fails normally on my dev box (Linux Mint), it causes a "Segmentation Fault" on my Continous Integration box (Centos). Both machines are running the same version of PHPUnit. My dev box is running PHP 5.3.2-1ubuntu4.9, and the CI is PHP 5.2.17. I'd rather leave upgrading the PHP as a last resort though. As per this thread: PHPUnit gets segmentation fault I have tried deactivating / reinstalling Xdebug. I don't have inclue.so installed. On the CI box I currently only have two

How do I correctly install PHPUnit with PEAR?

对着背影说爱祢 提交于 2019-12-18 10:33:16
问题 I have had to de- and reinstall a newer version of PHPUnit following these directions. Now when I'm launching this line sudo pear install --alldeps phpunit/PHPUnit I see an error message, that looks like this. Unknown remote channel: pear.symfony.com phpunit/PHPUnit requires package "channel://pear.symfony.com/Yaml" (version >= 2.1.0) No valid packages found If I install just Yaml by launching sudo pear install symfony/YAML an older version (1.0.6) will be installed that doesn't meet the

PhalconPHP MVC Micro app: Specify a request path and assert the response code

感情迁移 提交于 2019-12-18 09:13:55
问题 I've followed the unit testing tutorial and modified it to test a HTTP request to Micro MVC app, based on this post. I can successfully validate the output string, however I'm not sure how to assert the response status code or change the request path. index.php <?php $app = new \Phalcon\Mvc\Micro(); #Default handler for 404 $app->notFound(function () use ($app) { $app->response->setStatusCode(404, "Not Found")->sendHeaders(); }); $app->post('/api/robots', function() use ($app) { //Parse JSON

FOSUserBundle - PHPUnit - Mock a user

孤街醉人 提交于 2019-12-18 08:55:37
问题 I am using Symfony with the FOSUserBundle and now I like to test some things like: Doctrine lifecycle Controller behind firewall For those tests I need to be a specific user or at least in a user group. How do I mock a user session so that ... The lifecycle field like "createdAt" will use the logged in user The Controller act like some mocked user is logged in Example: class FooTest extends ... { function setUp() { $user = $this->getMock('User', ['getId', 'getName']); $someWhereGlobal->user =

Disable Soft Deleteable filter for hard delete record doesn't work

懵懂的女人 提交于 2019-12-18 06:58:17
问题 I'm trying to disable "Soft Deleteable" filter during functional testing and I do it as follow: First option: tried to disable at tearDown() in my test: protected function tearDown() { parent::tearDown(); $entityUser = $this->em->getRepository("UserSecurityBundle:User")->find($this->user->getUser()->getId()); $filter = $this->em->getFilters()->disable('softdeleteable'); $this->em->remove($entityUser); $this->em->flush(); $this->em->close(); } Didn't work. Second option: make a doctrine_test

Installing PHPUnit on MAMP 2.1.3 (Mountain Lion)

亡梦爱人 提交于 2019-12-18 06:54:16
问题 I'm struggling with this issue. Here's what I've tried : $ cd /Applications/MAMP/bin/php/php5.4.10/bin/ $ sudo ./pear channel-update pear.php.net $ sudo ./pear upgrade pear $ sudo /Applications/MAMP/bin/php/php5.4.10/bin/pear channel-discover pear.phpunit.de $ sudo /Applications/MAMP/bin/php/php5.4.10/bin/pear channel-discover pear.symfony-project.com $ sudo /Applications/MAMP/bin/php/php5.4.10/bin/pear install phpunit/PHPUnit So it seems to work, but phpunit is actually installed in

Testing chained method call in Mockery

爷,独闯天下 提交于 2019-12-18 03:38:13
问题 I'm trying to properly mock a chained call to an Eloquent model in a controller. In my controller I'm using dependancy injection to access the model so that it should be easy to mock, however I'm not sure how to test the chained calls and make it work right. This is all in Laravel 4.1 using PHPUnit and Mockery. Controller: <?php class TextbooksController extends BaseController { protected $textbook; public function __construct(Textbook $textbook) { $this->textbook = $textbook; } public

PHPunit Uncaught Error: Call to undefined method PHPUnit_Util_Configuration::getTestdoxGroupConfiguration()

柔情痞子 提交于 2019-12-18 02:17:13
问题 i don't know if it's related to Laravel 5.4. when i run phpunit command after installing laravel 5.4 without making any changes i get Uncaught Error: Call to undefined method PHPUnit_Util_Configuration::getTestdoxGroupConfiguration() but when i run php artisan dusk it runs normally c:\xampp\htdocs\ublocker>phpunit PHP Fatal error: Uncaught Error: Call to undefined method PHPUnit_Util_Configuration::getTestdoxGroupConfiguration() in C:\xampp\htdocs\ublocker\vendor\phpunit\phpunit\src\TextUI

Testing Controllers in Symfony2 with Doctrine

落爺英雄遲暮 提交于 2019-12-17 22:37:13
问题 I have created a very simple REST controller in Symony2 with Database insert/updates/deletes in the controller actions. Is there a nice way to write unit/integration tests for these controller actions without polluting the production database? Do I have to work with different environments - or is there a proposed way from the framework vendor for this? Current Controller Example: public function postAction() { $json = $this->getRequest()->getContent(); $params = json_decode($json); $name =

How to use phpunit installed from composer?

≡放荡痞女 提交于 2019-12-17 22:34:51
问题 I want to start unit testing my symfony 2 application with phpunit. I installed phpunit using composer (per-project dependancy). http://www.phpunit.de/manual/current/en/installation.html How do I now run the phpunit command on Zend Server? I don't have pear installed. 回答1: If you followed the documentation, you have set the phpunit/phpunit dependency as a 'dev-dependency'. If you don't have composer, you need to install it first. This is explained in the documentation: Installation *nix or