phpunit

PHPUnit - MockBuilder::enableProxyingToOriginalMethods() breaks when original constructor calls public method

给你一囗甜甜゛ 提交于 2019-12-24 22:35:59
问题 I'm trying to write a unit test that involves mocking a class whose constructor calls several public methods. Said public methods cannot be made private, at least for now. The same class also has magic methods that I want to keep unmocked (__get/__set/__isset), which is why I resorted to using enableProxyingToOriginalMethods() - I found no way to enable just those three original methods (source here: PHPUnit - call parent __get/__set/__isset). This makes the magic methods work, however it

PHPUnit and Yii on a shared server

 ̄綄美尐妖づ 提交于 2019-12-24 20:26:31
问题 I have installed PHPUnit and checked my PEAR settings and everything went fine. I'm using Yii as my framework and I am on a linux shared server. When I run a test (any test) I get the errors below. From what I can tell I think I need to add the following to my path settings: /home/myname/php/ since that is where both the PHP and PHPUnit folders are located. I am unable to modify the php.ini file since I am on a shared server. I am wondering if this is really the problem and if anyone else has

Symfony 4.2 How to do a service public only for tests

依然范特西╮ 提交于 2019-12-24 19:29:45
问题 I have the solution to make the service public. In the services.yml test_phpdocxService: alias: App\Service\PhpDocxService public: true I try to access the service: $container = self::$container; $phpDocxService = $container->get('test_phpdocxService'); $this->filename = $phpDocxService->generateDocxDocument('docx/aaa.html.twig', $data); But I find it not so nice. Is there an another way to do that? 回答1: You need to create in config/config_test.yml and declare that service is public and other

echo command not found while testing selenium with phpunit

霸气de小男生 提交于 2019-12-24 18:37:10
问题 I am getting an ERROR: Unknown command: 'echo' executing a selenium script with phpunit. Based on the output that echo command should be included in my version of PHPUnit. The selenium script does execute successfully in the firefox selenium IDE. mkdir_build: phpunit: [exec] PHPUnit 3.4.12 by Sebastian Bergmann. [exec] [exec] . [exec] TestFull [exec] E [exec] [exec] Time: 11 seconds, Memory: 6.50Mb [exec] [exec] There was 1 error: [exec] [exec] 1) TestFull::testNumberOne [exec] PHPUnit

PHPUnit 3.6 PHP 5.2.7 PHP Parse error: syntax error, unexpected T_FUNCTION, expecting ')' in /usr/local/bin/phpunit on line 16

女生的网名这么多〃 提交于 2019-12-24 17:09:22
问题 In our Development server, we have php 5.2 installed. I was asked to install phpunit on it. I followed the instruction on phpunit site as below: http://phpunit.de/manual/3.6/en/installation.html Note PHPUnit 3.6 requires PHP 5.2.7 (or later) but PHP 5.3.9 (or later) is highly recommended. PHP_CodeCoverage, the library that is used by PHPUnit to collect and process code coverage information, depends on Xdebug 2.0.5 (or later) but Xdebug 2.1.3 (or later) is highly recommended. The following two

Laravel 5.2 Mocked file upload unit test fails

孤街浪徒 提交于 2019-12-24 16:44:06
问题 I've just upgraded from Laravel 5.1 to 5.2 and previously successful tests are now failing, with "Perhaps an exception was thrown?" There were 3 failures: 1) TRP\Nps\Tests\FileHandlerControllerTest::testCSVFileUploadImportsRecipients Invalid JSON was returned from the route. Perhaps an exception was thrown? /home/vagrant/Code/nps/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/MakesHttpRequests.php:354 /home/vagrant/Code/nps/vendor/laravel/framework/src/Illuminate

Running PHPUnit tests Yii Framework

放肆的年华 提交于 2019-12-24 12:13:29
问题 What possibilities are there to run unit tests with my Yii application? So far, I have been testing them this way: Open command prompt > cd C:\WHEREVER MY APP IS\protected\tests > phpunit unit/TestingTest.php Now, I was wondering if there is another way. Im new to the testing world so to speak, but it seems to me that there must be a better way than running one by one all tests. Thanks for any tips, im sure the question is quite dumb! But maybe it turns out to be helpful to someone else out

How to wrap PHPUnit to control command line reporting?

对着背影说爱祢 提交于 2019-12-24 11:45:01
问题 So I've got a lot of PHPUnit tests (they are actually Selenium tests running as PHPUnit tests). When I run them from the command line, I get this sort of reporting as the tests complete: ..E..F..E.FF... Then I have to wait until all the tests finish running before it will tell me the errors and what failed. I would like to be able to control this so I can do some more useful reporting. For example: testLogin ....... passed testFoobar ...... failed - Failed asserting that foo = true on line

PHPUnit_Util_Type::export() in version 4.0

こ雲淡風輕ζ 提交于 2019-12-24 11:41:33
问题 Can you guys help me locate what happened to export function in this: https://github.com/sebastianbergmann/phpunit/blob/3.7/PHPUnit/Util/Type.php That function is still called by EcomDev_PHPUnit code (Magento tests). It's lurking somewhere else but I can't seem to find what happened to the export function. Thanks. 回答1: Found the commit: https://github.com/sebastianbergmann/phpunit/commit/b8b3e1fdc0312938d8ce2d7ff5958d52c865d780 All output function were moved to SebastianBergmann\Exporter

Please help me setting up codeigniter and phpunit

笑着哭i 提交于 2019-12-24 10:52:04
问题 I have created few simple apps in codeigniter never tested it. Can anyone give me some links or explain how to setup codeigniter with phpunit ? Many thanks 回答1: This ciunit fork works well and it is compatible with the latest CI 2.1 https://bitbucket.org/kenjis/my-ciunit 回答2: http://www.knollet.com/foostack/ 来源: https://stackoverflow.com/questions/3497896/please-help-me-setting-up-codeigniter-and-phpunit