我试图升级PHPUnit到最新版本,但我得到错误“安装失败”。
我用一些在线教程安装了PHPUnit。
$ phpunit --version
PHPUnit 5.1.3 by Sebastian Bergmann and contributors.
我相信现时的版本是5.5。我正在尝试以下命令。
$ sudo pear install -a -f phpunit/PHPUnit
Attempting to discover channel "phpunit"...
Attempting fallback to https instead of http on channel
Laravel项目,简单测试,只尝试加载默认页面“/”
简单测试
<?php
namespace Tests\Feature;
use Tests\TestCase;
use Illuminate\Foundation\Testing\WithoutMiddleware;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Foundation\Testing\DatabaseTransactions;
class ExampleTest extends TestCase
{
/**
我已经使用Zend Framework配置了PHPUnit。当我运行该命令时
phpunit --configuration phpunit.xml
我收到失败消息,如下所示
Declaration of Zend_Test_PHPUnit_Constraint_ResponseHeader::evaluate() should be compatible with that of PHPUnit_Framework_Constraint::evaluate()
我有以下assert函数
$this->assertModule($urlParams['module']);
C:\Program Files\PHP>pear install phpunit/PHPUnit
Did not download optional dependencies: ezc/ConsoleTools, use --alldeps to download automatically
downloading PHPUnit-3.5.13.tgz ...
Starting to download PHPUnit-3.5.13.tgz (118,553 bytes)
..........................done: 118,553 bytes
could not e
我目前正试图在我的Ubuntu12.04虚拟机上运行PHPUnit,当我在我的应用程序根目录下运行phpunit时,它从配置中读取了phpunit.xml.dist文件,但我得到了下面的错误,它失败了:
PHP Fatal error: Call to undefined method PHPUnit_Util_Test::getHookMethods() in phar:///usr/bin/phpunit/phpunit/Framework/TestSuite.php on line 633
有没有发生这种情况的原因?
我正在尝试在CI/CD设置中使用PHPUnit运行单元测试。问题是我得到了以下错误: PHPUnit testing framework version 6 or greater is required when running on PHP 7.0 or greater. Run the command 'composer run-script drupal-phpunit-upgrade' in order to fix this. 但是我有正确版本的PHPUnit和PHP7.2.14。我尝试运行建议的命令,但都不起作用。 vendor/bin/phpunit --ver
在PHPUnit中使用php类反射时,我遇到了一个奇怪的案例。下面是我在expected类中的做法,它从get_called_class()中生成"ChildClass“,正如我所期望的:
class ParentClass {
static function funcA() {
echo get_called_class() . PHP_EOL;
}
}
class ChildClass extends ParentClass {
}
class MyTest {
public function test() {
$refl
我有以下需要与phpunit一起运行的示例测试代码(PHP4
<?php
require_once 'PHPUnit/Framework.php';
class RemoteConnectTest extends PHPUnit_Framework_TestCase
{
public function setUp(){ }
public function tearDown(){ }
public function testConnectionIsValid()
{
$this->assertTrue(true);
}
}
?>
我正在使用php 7和phpunit 6。下面是我编写的测试:
<?php declare(strict_types=1);
namespace Test;
use DesignPatterns\Observer\User;
use DesignPatterns\Observer\UserObserver;
use PHPUnit\Framework\TestCase;
class ObserverTest extends TestCase
{
public function testChangeInUserLeadsToUserObserverBeingNotified(
我只是在测试如何使用Php单元。
这是我的DependencyFailureTest课程:
require_once '../vendor/autoload.php';
use PHPUnit\Framework\TestCase;
class DependencyFailureTest extends \PHPUnit\Framework\TestCase
{
public function testOne()
{
$this->assertTrue(false);
}
/**
* @depends test
首先,我收到一个警告和一个致命错误。警告:
Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"?
然后我用break替换了continue,警告消失了。但即使在替换之后,致命的错误仍然会发生。致命错误:
PHP Fatal error: Uncaught Error: Call to undefined function each() in D:\xampp\php\pear\PHPUnit\Util\G
预期行为:
方法应该将集合转换为普通的array,并将集合中作为Arrayable实例的所有嵌套对象转换为数组。
实际行为:
toArray()方法将集合转换为普通array,但嵌套对象不会转换。请注意,只有当toArray()通过PHPUnit调用时,才会观察到这种行为。当toArray()函数在应用程序中调用或通过Laravel调用时,它会按预期工作。
复制步骤:
克隆,安装软件包,运行PHPUnit。
<?php
namespace Tests\Unit;
use App\User;
use Illuminate\Contracts\Support\Arrayable;
u
我在windows10上的流浪安装程序上安装了php 7.0.29版本。
当我运行以下命令时
composer require --dev phpunit/phpunit
我收到了前面提到的错误
Using version ^6.5 for phpunit/phpunit
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not b
我在我的本地计算机(服务器)上工作。这是第一次安装Laravel 6。输入以下命令,
Laravel new project
所说的
Installing dependencies (including require-dev) from lock file
Your requirements could not be resolved to an installable set of packages.
Problem 1
- This package requires php ^7.2 but your HHVM version does not satisfy that r
我最近安装了php (8.1.7)、composer (2.3.7)和laravel 9;现在在一个laravel项目上运行命令composer update时,我得到了这个错误,我搜索了很多,但没有找到确切的解决方案,它们都没有讨论phpunit/phpunit的问题。
错误如下所示:
Problem 1
- phpunit/phpunit[6.0.0, ..., 6.5.14] require php ^7.0 -> your php version (8.1.7) does not satisfy that requirement.
- Root compose
几天来,我一直在努力想要在我的Mac电脑上正确安装。
我遵循了https://www.drupal.org/node/1674222上的说明
Composer安装得很好,但是当我在cd中运行drush-master并运行composer install时,我得到:
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of p