phpunit

How to test for static files located in the web folder in symfony with phpunit?

房东的猫 提交于 2020-02-03 05:38:11
问题 sysinfo: PHPUnit 5.7.4 PHP 7.0.13 Symfony 3.2.1 i am trying to follow a link on a "download" page and verify the file is downloadable but when i follow the link $client->click($crawlerDownload->link()); i get a 404 . is it not possible for the symfony $client to access a static file in the webdirectory? how can i test this? the favicon test is the simplified version of the testcase. public function testPressDownload() { $client = static::createClient(); $client->followRedirects(false); /

Selenium PHPUnit select element by label text

独自空忆成欢 提交于 2020-02-02 16:12:34
问题 I have the following HTML code snippet: <div class="modal-body" style="max-height: 317px;"> <div class="radio"> <label> <input type="radio" name="template" value="5"> <img src="/img/custom-icons/Monitor.png" style="height: 24px"> First descriptive title <p class="text-muted">Some description text</p> </label> </div> <div class="radio"> <label> <input type="radio" name="template" value="37"> <img src="/img/custom-icons/Monitor.png" style="height: 24px"> Second descriptive title <p class="text

Suppressing the request when running PHPUnit with Kohana 3.2

血红的双手。 提交于 2020-02-02 15:20:22
问题 I'm having trouble correctly setting up unit testing in Kohana 3.2. I installed PHPUnit. I changed the bootstrap to activate Kohana's unittest module. I also changed the index.php file to look like this: if ( ! defined('SUPPRESS_REQUEST')) { echo Request::factory() ->execute() ->send_headers() ->body(); } I created a folder tests in my application folder. In it, I inserted a phpunit.xml file that looks like this: <phpunit colors="true" bootstrap="../../index.php"> <testsuites> <testsuite name

How do I update phpunit?

为君一笑 提交于 2020-02-02 03:14:07
问题 I have already tried everything , including https://stackoverflow.com/a/8740349/251311 and all possible channel upgrade and clear cache commands. But still: $ sudo pear install -a -f phpunit/PHPUnit downloading PHPUnit-3.6.12.tgz ... Starting to download PHPUnit-3.6.12.tgz (120,240 bytes) ..........................done: 120,240 bytes install ok: channel://pear.phpunit.de/PHPUnit-3.6.12 while: $ pear list-upgrades Channel pear.php.net: No upgrades available pear.phpunit.de Available Upgrades

How to use the method setup from PHPUnit in Laravel 5.8

穿精又带淫゛_ 提交于 2020-01-30 02:44:56
问题 I used to use the method setup of PHPUnit to create a instance for my test methods. But in Laravel 5.8 I can't do it I've tried both ways, and it's works makes an instance per method how showed below. This works: <?php namespace Tests\Unit; use Tests\TestCase; use Illuminate\Foundation\Testing\WithFaker; use Illuminate\Foundation\Testing\RefreshDatabase; use App\Service\MyService; class MyServiceTest extends TestCase { /** * A basic unit test example. * * @return void */ public function

How to use the method setup from PHPUnit in Laravel 5.8

点点圈 提交于 2020-01-30 02:44:07
问题 I used to use the method setup of PHPUnit to create a instance for my test methods. But in Laravel 5.8 I can't do it I've tried both ways, and it's works makes an instance per method how showed below. This works: <?php namespace Tests\Unit; use Tests\TestCase; use Illuminate\Foundation\Testing\WithFaker; use Illuminate\Foundation\Testing\RefreshDatabase; use App\Service\MyService; class MyServiceTest extends TestCase { /** * A basic unit test example. * * @return void */ public function

PHPUnit 组织测试

五迷三道 提交于 2020-01-26 09:25:05
https://www.cnblogs.com/foreversun/p/6837147.html 首先是目录结构 源文件夹为 src/ 测试文件夹为 tests/ User.php <?php class Errorcode { const NAME_IS_NULL = 0; } class User { public $name; public function __construct($name) { $this->name=$name; } public function Isempty() { try{ if(empty($this->name)) { throw new Exception('its null',Errorcode::NAME_IS_NULL); } }catch(Exception $e){ return $e->getMessage(); } return 'welcome '.$this->name; } } 对应的单元测试文件 UserTest.php <?php use PHPUnit\Framework\TestCase; class UserTest extends TestCase { protected $user; public function setUp() { $this->user = new User(''); }

Scrutinizer and specific test from phpunit

谁说我不能喝 提交于 2020-01-25 07:04:35
问题 I have this phpunit.xml file: <phpunit> <testsuites> <testsuite name="domoticz-api"> <directory suffix="Test.php">tests</directory> </testsuite> <testsuite name="scrutinizer"> <file>tests/Domoticzapi4Scrutinizer/ClientTest.php</file> </testsuite> </testsuites> </phpunit> Following this answer: How to run a specific phpunit xml testsuite? In my server I can do: ./vendor/bin/phpunit --configuration phpunit.xml --testsuite scrutinizer to perform test. Other test (main test) for several reason I

PHPUnit autoloading classes

本秂侑毒 提交于 2020-01-25 01:07:28
问题 Question in short How can I make the Autoloader find all classes required to run my PHP tests? Question in detail I want to autoload the classes that I am using in PHPUnit in Eclipse. My directory structure is as follows. Project (called yii-app) protected dirA classA.php dirB classB.php yii-1.1.14.f0fee9 Yii.php tests ClassATest.php ClassBTest.php bootstrap.php Autoloader.php I use the bootstrap.php and Autoloader.php that I found here, see below for details. The Class classA does not make

PHPUnit 组织测试

我与影子孤独终老i 提交于 2020-01-24 19:55:30
首先是目录结构 源文件夹为 src/ 测试文件夹为 tests/ User.php <?php class Errorcode { const NAME_IS_NULL = 0; } class User { public $name; public function __construct($name) { $this->name=$name; } public function Isempty() { try{ if(empty($this->name)) { throw new Exception('its null',Errorcode::NAME_IS_NULL); } }catch(Exception $e){ return $e->getMessage(); } return 'welcome '.$this->name; } } 对应的单元测试文件 UserTest.php <?php use PHPUnit\Framework\TestCase; class UserTest extends TestCase { protected $user; public function setUp() { $this->user = new User(''); } public function testIsempty() { $this->user->name=