我想使用PHPUnit来创建代码覆盖率报告.我已尝试在网上找到很多安装设置.但似乎没有任何结果.
我使用最新版本的Laravel 5(> 5.2)和PHPUnit v.5.0.10.此外,我在运行PHP 7的Mac OS X 10.9.5上使用MAMP.
当我运行集成在Laravel发行版中的PHPUnit时,我收到以下错误.
$ vendor/bin/phpunit -v
PHPUnit 5.0.10 by Sebastian Bergmann and contributors.
Runtime: PHP 7.0.0
Configuration: /Applications/MAMP/htdocs/myProject/phpunit.xml
Error: No code coverage driver is available`
Run Code Online (Sandbox Code Playgroud)
我的作曲家文件看起来像:
"require-dev": {
"fzaninotto/faker": "~1.4",
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "5.0.*",
"phpunit/php-code-coverage": "^3",
"symfony/css-selector": "2.8.*|3.0.*",
"symfony/dom-crawler": "2.8.*|3.0.*"
},
Run Code Online (Sandbox Code Playgroud)
我也尝试了以下命令:
/Applications/MAMP/bin/php/php7.0.0/bin/phpdbg -qrr ../../../htdocs/myProject/vendor/bin/phpunit -v
Run Code Online (Sandbox Code Playgroud)
这似乎很好地设置了代码覆盖率驱动程序,但最终会出现异常:
$ /Applications/MAMP/bin/php/php7.0.0/bin/phpdbg -qrr ../../../htdocs/myProject/vendor/bin/phpunit -v
PHPUnit 5.0.10 by Sebastian Bergmann and contributors.
Runtime: PHPDBG 7.0.0
Configuration: /Applications/MAMP/htdocs/myProject/phpunit.xml
[PHP Fatal error: Uncaught ErrorException: include(/Applications/MAMP/htdocs/myProject/app/Exceptions/Handler.php): failed to open …
Run Code Online (Sandbox Code Playgroud) 我将我的 Laravel 应用程序升级到最新版本的 Laravel 8。我现在的问题是我无法弄清楚如何将应用程序抛出的异常呈现为 html,以便将该 html 作为电子邮件发送。
我当前的代码(适用于 Laravel 5)在类中呈现和发送异常App\Exceptions\Handler
:
public function sendEmail(Exception $exception)
{
try {
$e = FlattenException::create($exception);
$handler = new SymfonyExceptionHandler();
$html = $handler->getHtml($e);
$routeName = URL::full();
Mail::send(new ExceptionEmail($html, $routeName));
} catch (Exception $ex) {
if (env("APP_DEBUG") == true) {
dd($ex);
}
}
}
Run Code Online (Sandbox Code Playgroud)
问题是\Symfony\Component\Debug\Exception\FlattenException
我升级的应用程序中不再存在该类。
现在在 Laravel 8 中将异常呈现为 html 的合适方法是什么?
非常感谢您提前。
我想在我的Debian 6.0.4机器上安装GitLabHQ.这是2012年4月13日的全新安装.现在我已经到了需要一些安装由Ruby gem完成的地步.特别是:
gem install bundler
Run Code Online (Sandbox Code Playgroud)
这显示以下错误:
Successfully installed bundler-1.1.3
1 gem installed
Installing ri documentation for bundler-1.1.3...
ERROR: While executing gem ... (ArgumentError)
undefined class/module Encoding
Run Code Online (Sandbox Code Playgroud)
然后我尝试重建Ruby包
gem pristine --all
Run Code Online (Sandbox Code Playgroud)
这没有用.以下是安装的Ruby包列表:
rake-0.9.2.2 at Sat Apr 14 20:44:40 2012
rvm-1.11.3.3 at Sat Apr 14 20:44:47 2012
rubygems-bundler-0.9.0 at Mon Apr 16 09:04:32 2012
rack-test-0.6.1 at Mon Apr 16 09:11:10 2012
daemon_controller-1.0.0 at Mon Apr 16 09:11:10 2012
tilt-1.3.3 at Mon Apr 16 09:11:10 2012
erubis-2.7.0 at Mon Apr 16 09:11:10 …
Run Code Online (Sandbox Code Playgroud) 我想在我的 Word 文档中使用 docx4j 创建一个带有项目符号的未编号列表。我发现下面的代码应该可以完成这项工作。但无论我尝试什么,生成的列表都是一个编号列表!我使用Word 2010,德语版和docx4j-2.8.1。
wordMLPackage = WordprocessingMLPackage.createPackage();
ObjectFactory factory = new org.docx4j.wml.ObjectFactory();
P p = factory.createP();
org.docx4j.wml.Text t = factory.createText();
t.setValue(text);
org.docx4j.wml.R run = factory.createR();
run.getContent().add(t);
p.getContent().add(run);
org.docx4j.wml.PPr ppr = factory.createPPr();
p.setPPr(ppr);
// Create and add <w:numPr>
NumPr numPr = factory.createPPrBaseNumPr();
ppr.setNumPr(numPr);
// The <w:ilvl> element
Ilvl ilvlElement = factory.createPPrBaseNumPrIlvl();
numPr.setIlvl(ilvlElement);
ilvlElement.setVal(BigInteger.valueOf(0));
// The <w:numId> element
NumId numIdElement = factory.createPPrBaseNumPrNumId();
numPr.setNumId(numIdElement);
numIdElement.setVal(BigInteger.valueOf(1));
wordMLPackage.getMainDocumentPart().addObject(p);
Run Code Online (Sandbox Code Playgroud)
有人可以帮我生成一个真正的无序、项目符号列表吗?!
MAMP 安装在 MacBook 中。我使用 MAMP apache。
基于许多在线资源,我做了以下工作:
我添加127.0.0.1 my-site.local
到文件/etc/host
.
我Include /Applications/MAMP/conf/apache/extra/httpd-vhosts.conf
在/Applications/MAMP/conf/apache/httpd.conf
.
在 中/Applications/MAMP/conf/apache/extra/httpd-vhosts.conf
,我添加了
<VirtualHost *:80>
DocumentRoot "/Users/myname/laravel/mysite/public"
ServerName my-site.local
ServerAlias my-site.local
<Directory "/Users/myname/laravel/mysite/public">
DirectoryIndex index.php
Options +Indexes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
Run Code Online (Sandbox Code Playgroud)在/Users/myname/laravel/mysite/.htaccess
文件中:
<IfModule mod_rewrite.c>
Options +Indexes +FollowSymLinks +MultiViews
RewriteEngine On
#RewriteBase /
# Redirect Trailing Slashes If Not A Folder...
#RewriteCond %{REQUEST_FILENAME} !-d
#RewriteRule ^(.*)/$ /$1 [L,R=301]
RewriteCond %{HTTP:Authorization} ^(.*)
RewriteRule .* - …
Run Code Online (Sandbox Code Playgroud)