phpunit

Selenium2 + phpunit -> drag and drop on xpath

半世苍凉 提交于 2019-12-24 00:11:01
问题 I use PHPUnit_Extensions_Selenium2TestCase Selenium and phpunit and I need make drag and drop one xpath element, on diferent emelent. Like on this screen, to change position on tree (category tree) 回答1: $srcDrag=$this->byId('draggable'); $targetDrop=$this->byId('droppable'); $stateChecker=$this->byCssSelector('#droppable > p'); $this->assertEquals("Drop here",$stateChecker->text()); $this->moveto($srcDrag); $this->buttondown(); $this->moveto($targetDrop); $this->buttonup(); 回答2: Drag and Drop

Laravel Testing login Credential using phpunit + multiprocess

拜拜、爱过 提交于 2019-12-23 22:11:45
问题 I'm pretty new on unit testing and I want to try to test my login page my Goal for this unit are : -> if it match in database -> redirect to route '/' -> if not -> redirect to route '/login' <?php namespace Tests\Feature; use App\Domain\Core\Models\User; use Illuminate\Support\Facades\Hash; use Illuminate\Support\Facades\Session; use Tests\TestCase; use Illuminate\Foundation\Testing\WithoutMiddleware; use Illuminate\Foundation\Testing\DatabaseMigrations; use Illuminate\Foundation\Testing

How to use output buffering inside PHPUnit test?

烈酒焚心 提交于 2019-12-23 21:15:05
问题 I'm using PHPUnit to test a function which downloads a file. I want to test that the correct file is downloaded and so my idea was to check the output of the function. I'm trying to use output buffering: ob_start(); $viewer->downloadById($fileId); $output = ob_get_flush(); $this->assertEquals($expectedFileContents,$output); The test passes/fails when it should, which is good. My issue is that the contents of the output buffer is also printed to the console. How do I hide this? 回答1: Use ob_get

How to setup HHVM for PHPUnit in PhpStorm

血红的双手。 提交于 2019-12-23 20:28:00
问题 How could I run my unit tests in PhpStorm 8 with HHVM as its interpreter? PhpStorm 8 supports PHPUnit 4 which that supports HHVM and I could run my test suite on termianl with HHVM but I do not know how to config PhpStorm 8 in order to run my unit tests with HHVM. 回答1: Now by PHPStorm 8.0.2 it becomes possible: Under the PHP setting, add a new interpreter located in /usr/bin/hhvm or /usr/local/bin/hhvm 来源: https://stackoverflow.com/questions/26036090/how-to-setup-hhvm-for-phpunit-in-phpstorm

PHPUnit picking up on syslog messages?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-23 19:18:06
问题 I am testing a logger class with a method that opens a log like so: openlog($this->identifier, $this->option, $this->facility); syslog($level, $message) closelog(); The $facility that my logger writes to is currently set as LOCAL0 When I unit test my logger I get the following message: Broadcast message from systemd-journald@myWS: phpserver7.0[9125]: Logger message How can I suppress this message with PHPUnit or in my code? Edit: This only seems to happen when I log a message with a severity

PHP code coverage and Selenium

会有一股神秘感。 提交于 2019-12-23 19:13:16
问题 I came across this thread on SO which talks about PHP code coverage tools - Code Coverage tools for PHP I have never worked on PHP and have been writing Selenium UI tests using java against an application which has been written in PHP. While going through the thread I mentioned above I felt (I might be wrong) that those PHP code coverage tools are to be used when there are unit tests written in PHP Unit and one wants to find how well Unit tests cover the application. I am looking for a

Yii Fixtures Issue?

左心房为你撑大大i 提交于 2019-12-23 17:43:54
问题 I seem to be having a problem with fixtures in Yii. The problem seems to be the following, public $fixtures=array('projects'=>'Project'); The model Project exists and I have the fixtures in a file name tbl_project.php in the fixtures folder of tests and my table name is called tbl_project. Inside the fixtures file is the following. return array( 'project1' => array( 'name' => 'Test Project 1', 'description' => 'This is test project 1', 'create_time' => '', 'create_user_id' => '', 'update_time

How to make PHPUnit fail on risky tests

我是研究僧i 提交于 2019-12-23 17:37:12
问题 I want PHPUnit to fail if one or more test is considered as risky. Actually: PHPUnit 5.3.4 by Sebastian Bergmann and contributors. ..RRR.. 7 / 7 (100%) Time: 2.83 seconds, Memory: 26.00Mb OK, but incomplete, skipped, or risky tests! Tests: 7, Assertions: 137, Risky: 3. It says "OK, but incomplete", so my tests did not fail (and can be shipped in case of continous delivery). Is there any way to have a "fail" status? I want my test global status considered as failed on risky test, don't know if

(PHP): Testing models with Zend_Test_PHPUnit_DatabaseTestCase

雨燕双飞 提交于 2019-12-23 17:33:44
问题 When I run my PHP unit test I get: 1) Test_Model_Mapper_TestTest::testTest Argument 1 passed to PHPUnit_Extensions_Database_DataSet_DefaultTableIterator::__construct() must be an array, null given, called in /usr/share/php/PHPUnit/Extensions/Database/DataSet/AbstractXmlDataSet.php on line 134 and defined /var/www/kosheroven/library/Zend/Test/PHPUnit/Db/Operation/Truncate.php:73 /var/www/kosheroven/tests/ModelTestCase.php:79 /var/www/kosheroven/tests/application/models/mappers/TestTest.php:33

PHPUnit - Call to undefined function curl_init() error

…衆ロ難τιáo~ 提交于 2019-12-23 17:28:02
问题 I'm using PHPUnit to try to unit test some PHP files that are part of a web application I'm developing. I've got a WAMP server set up, and have set my php.ini file to have the curl extension installed. I've verified it's installed by checking phpinfo(), and curl does have a config section on the page, indicating it's installed. When I run my entire web application starting from the index page, this php page I'm trying to test finds the curl_init() function without a problem. When I run my