phing

如何提高 PHP 代码的质量?

醉酒当歌 提交于 2020-10-15 00:39:11
说实话,在代码质量方面,PHP 的压力非常大。通过阅读本系列文章,您将了解如何提高 PHP 代码的质量。 我们可以将此归咎于许多原因,但这肯定不仅仅是因为 PHP 生态系统缺乏适当的测试工具。在本文中,我想向您展示一个简单的设置,用于项目的基本质量测试。 我不会详述任何特定的工具,而是专注于设定测试环境。 本文中有一个演示代码可以在 GitHub 上找到: https://github.com/mkosiedowski/php-testing-demo 如果你对这篇文章中的例子有任何问题,可以参考。 1 必备条件 我假设您熟悉 PHP 7.1 语法,您可以使用 Composer 和 PSR-4 来进行自动加载和 PSR-1&PSR-2 的编码标准。在我的示例中,vendor 的二进制文件被安装到 ./bin 目录。 2 构建工具 我们将使用一些不同的测试工具,所以最好有一些能用一个脚本来运行它们的东西。 PHING 为我们提供了解决此问题的绝佳解决方案。 PHing 与 Apache Ant 相似,可以使用 XML 配置轻松自动执行任务。 我们可以通过运行以下命令来安装它: 复制代码 $ php composer.phar require --dev phing/phing 然后,在项目的根目录中创建一些基本的 build.xml 文件。 <? xml version = "1

How to provide a password for PostgreSQL's createdb non-interactively?

匆匆过客 提交于 2020-08-24 07:09:00
问题 I have a task in phing where before tests I drop the database if exists and create it. This is run on Jenkins. I want to do it with createdb like this: <exec command="createdb my_database" /> The thing is that the createdb is asking me to authenticate and adding -Umy_user parameter is not a problem - the issue is that I cannot specify a password in the createdb command. And I don't want to create a role for the system user ("jenkins" in this case). Is there a solution for that ? 回答1: createdb

How to provide a password for PostgreSQL's createdb non-interactively?

て烟熏妆下的殇ゞ 提交于 2020-08-24 07:08:16
问题 I have a task in phing where before tests I drop the database if exists and create it. This is run on Jenkins. I want to do it with createdb like this: <exec command="createdb my_database" /> The thing is that the createdb is asking me to authenticate and adding -Umy_user parameter is not a problem - the issue is that I cannot specify a password in the createdb command. And I don't want to create a role for the system user ("jenkins" in this case). Is there a solution for that ? 回答1: createdb

phing

落花浮王杯 提交于 2020-08-18 04:05:31
centos7 phing安装 yum install -y phing    官网: https://www.phing.info/ 来源: oschina 链接: https://my.oschina.net/u/4258260/blog/4278650

How to take local working directory to any git revision irrespective of its branch after remote changes?

旧城冷巷雨未停 提交于 2020-01-07 02:42:44
问题 Background I am working on a phing build script, which takes input as the target revision to which the production codebase needs to be taken. I am preparing the same in a separate scratchpad directory and then overwriting the production codebase. Current logic During every build, I am simply emptying the scratchpad and taking a fresh clone of the entire git repository in it. Taking to the desired revision - git reset --hard ${target.git_version} I am sure something more efficient can be done.

Phing error when using gitclone - Git tasks depend on PEAR\'s VersionControl_Git package

本小妞迷上赌 提交于 2020-01-05 15:17:32
问题 When I run phing install i keep getting this error: Execution of target "install" failed for the following reason: /Applications/MAMP/htdocs/wp-test/build.xml:7:8: /Applications/MAMP/htdocs/wp-test/build.xml:7:8: The Git tasks depend on PEAR\'s VersionControl_Git package. So I download the package: downloading VersionControl_Git-0.4.4.tgz ... Starting to download VersionControl_Git-0.4.4.tgz (14,831 bytes) .....done: 14,831 bytes install ok: channel://pear.php.net/VersionControl_Git-0.4.4 But

Phing with PHPUnit 0 tests executed

不羁岁月 提交于 2020-01-05 13:27:43
问题 I'm trying to execute PHPUnit with phing but i'm finding some errors. I have my target: <target name="tests"> <phpunit pharlocation="C:/xampp/php/phpunit.phar" printsummary="true" haltonfailure="true" haltonerror="true"> <formatter type="xml" usefile="false"/> <batchtest> <fileset dir="."> <include name="tests/*Test*.php"/> </fileset> </batchtest> </phpunit> </target> But when i execute i have: [phpunit] <?xml version="1.0" encoding="UTF-8"?> [phpunit] <testsuites> [phpunit] <testsuite name=

Why Phing/Ant over Bash and Make? [closed]

你说的曾经没有我的故事 提交于 2020-01-02 02:13:06
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 6 years ago . I've been using Phing at work (it was set up when I got there), and thinking of using it for some personal projects. One thing I haven't got my head around yet though is what the big appeal is? What, if any, are the killer features of Phing or Ant? What are the big reasons

Preprocessing PHP to remove functionality from built files

邮差的信 提交于 2020-01-01 10:09:02
问题 I've been reading about Phing and Ant and I'm not sure which, if either, of these tools are most useful for this scenario. It could easily be debug statements etc, but I'll give you our literal scanario. We have a free and premium version of a downloadable PHP app, and rather than including just a variable hidden somewhere and then doing: if($premium == true) { echo 'some additional functionality'; } else { echo 'basic functionality'; } Obviously someone could then take the source and change

Preprocessing PHP to remove functionality from built files

隐身守侯 提交于 2020-01-01 10:08:30
问题 I've been reading about Phing and Ant and I'm not sure which, if either, of these tools are most useful for this scenario. It could easily be debug statements etc, but I'll give you our literal scanario. We have a free and premium version of a downloadable PHP app, and rather than including just a variable hidden somewhere and then doing: if($premium == true) { echo 'some additional functionality'; } else { echo 'basic functionality'; } Obviously someone could then take the source and change