phpunit

How to create a Symbolic link to PHPUnit?

南楼画角 提交于 2019-12-24 10:51:51
问题 I'm using Laravel. Whenever I need to run the tests I have to execute PHPUnit in the following directory: vendor/phpunit/phpunit/phpunit How can I create a symlink to the file above so that I don't have to type in the full path to phpunit every time ? I tried the following command but didn't work: ln -s vendor/phpunit/phpunit/phpunit mysym For some reason, it says 'Command Not Found' when I try to execute the Symlink. 回答1: How can I create a symlink to the file above so that I don't have to

How to mock EntityManager for phpUnit?

房东的猫 提交于 2019-12-24 09:27:54
问题 I am writing a Unit test for this class: <?php namespace AppBundle\Managers\CRUD; use Doctrine\ORM\EntityManager; use CommonLibs\Interfaces\CrudManagerInterface; use AppBundle\Entity\Pet; use CommonLibs\Helpers\PaginatorHelper; use AppBundle\Entity\Person; use AppBundle\Managers\CRUD\PetManager; use AppBundle\AppBundle; class PersonManager extends CrudManagerInterface { /** * @var EntityManager */ private $em; /** * @var PetManager */ private $petManager; public function __construct

Deal with AJAX block in web-crawler or create manually inputs

喜欢而已 提交于 2019-12-24 07:49:10
问题 Based on Alvin Bunk article link to article I want to create a web-cralwer that logins in a website then submits a form. My problem is that on that website there is an Ajax block that generates after clicking and empty link few inputs that I need to fill so I need to click that empty link somehow or to insert the inputs manually . I changed the code below in a lot of ways to try to make it work but on the visit function I got stuck I get Uncaught Error: Call to a member function visit() on

Hudson keeps failing with Phing AND Ant. Any hints?

久未见 提交于 2019-12-24 07:39:33
问题 Let's just skip right to the good stuff... errors I'm getting from the console when running Ant: phpunit: [exec] PHPUnit 3.2.16 by Sebastian Bergmann. [exec] [exec] Class /var/lib/hudson/jobs/Goals/workspace/Goals/AllTests could not be found in /var/lib/hudson/jobs/Goals/workspace/Goals/AllTests.php. [exec] Result: 1 phpcpd: [exec] The referenced parameter '--log-pmd=/var/lib/hudson/jobs/Goals/workspace/Goals/build/logs/pmd.xml' is not registered. [exec] Result: 1 pdepend: [exec] ALERT -

Automatically run specific tests on file change?

限于喜欢 提交于 2019-12-24 07:27:12
问题 I'm looking for a way to automatically run specific tests when specific files are changed, similar to what you can do with a Guardfile in Ruby on Rails . I was wondering if there is a way to do this with Laravel Elixir or with gulp (I.e. gulpfile.js ) Here is an example of what I'm looking for: watch('^app/Http/Controllers/(.+)(Controller)\.php$', function($match) { return ["tests/{$match[1]}"]; }); watch('^app/Policies/(.+)(Policy)\.php$', function($match) { return ['tests/' . str_plural(

CodeCoverage with PHPunit not generating

巧了我就是萌 提交于 2019-12-24 04:57:15
问题 PHPunit 3.7.1 PHP 5.3.14 Windows 7 Using cmd I "cd" into the dir where phpunit.xml lives and run phpunit -c phpunit.xml but that dosen't generate any code coverage. phpunit.xml: <phpunit bootstrap="./bootstrap.php" verbose="true" > <testsuites> <testsuite name="Test Suite"> <directory suffix=".php">./Base/src/</directory> <filter> <whitelist addUncoveredFilesFromWhitelist="true"> <directory suffix=".php">../src</directory> <exclude> <directory suffix=".php">../../vendor</directory> </exclude>

CodeCoverage with PHPunit not generating

蹲街弑〆低调 提交于 2019-12-24 04:57:07
问题 PHPunit 3.7.1 PHP 5.3.14 Windows 7 Using cmd I "cd" into the dir where phpunit.xml lives and run phpunit -c phpunit.xml but that dosen't generate any code coverage. phpunit.xml: <phpunit bootstrap="./bootstrap.php" verbose="true" > <testsuites> <testsuite name="Test Suite"> <directory suffix=".php">./Base/src/</directory> <filter> <whitelist addUncoveredFilesFromWhitelist="true"> <directory suffix=".php">../src</directory> <exclude> <directory suffix=".php">../../vendor</directory> </exclude>

Group/Filter in phpunit doesnt execute specific test case

不打扰是莪最后的温柔 提交于 2019-12-24 04:42:30
问题 i have a suite that calls multiple suites and many functions for LOG,REPORT and Execution if i m trying the same 'Group or Filter' pattern its executes all the test cases without executing the selected single test cases. Edit: I am using an array suite as follows, $suite->addTestSuite('adminSuite'); $suite->addTestSuite('staffSuite'); $suite->addTestSuite('merchantSuite'); // Run the test PHPUnit_TextUI_TestRunner::run($suite, array( 'junitLogfile' => $path_log )); I am calling this file

Selenium RC: How to check if an element has a given attribute?

此生再无相见时 提交于 2019-12-24 04:13:09
问题 I have some buttons with an onclick attribute and some that don't. I want to check if the specified element has the onclick attribute. How can I do this? getAttribute() returns the attribute value when it has one. When it doesn't, it throws a RuntimeException and stops the test (even when I wrap it in a try/catch block). $onclickValue = $this->getAttribute("$locator@onclick"); //works when the attribute exists 回答1: By using getEval() , you can execute the javascript hasAttribute() function.

How to submit an invalid select option in WebTestCase with symfony 2.3

谁都会走 提交于 2019-12-24 04:09:11
问题 I am trying to test a form in symfony 2.3 that has a select input... along with a file upload (enctype multipart/form-data) The select input is as follows... It is a required field. Has 3 options [1, 2, 3] with the DomCrawler i select the form $form = $crawler->selectButton->('Update')->form() then try to set the value of the select with $form['select'] = null or $form['select'] = ssjksjkajsdfj There is an internal validation system in the DomCrawler that returns the following error if i do