简体   繁体   English

如何执行10月/图书馆的单元测试

[英]How to execute unit tests for octobercms/library

What is the proper way of executing unit tests for octobercms/library ? octobercms /图书馆执行单元测试的正确方法是什么?

I could successfully execute unit tests with the following condition. 我可以在以下条件下成功执行单元测试。

  • Use the copy installed in my OctoberCMS project in vendor directory. 使用安装在我的OctoberCMS项目中的供应商目录中的副本。
  • Modify bootstrap path in october/rain/tests/phpunit.xml to bootstrap="../../../../vendor/autoload.php" 将october / rain / tests / phpunit.xml中的bootstrap="../../../../vendor/autoload.php" bootstrap路径修改为bootstrap="../../../../vendor/autoload.php"
  • Execute ../../../../vendor/bin/phpunit from october/rain/tests. 从10月/雨/测试中执行../../../../vendor/bin/phpunit

But, I feel like there is a better way. 但是,我觉得有更好的方法。 I wonder how other committer is executing tests. 我想知道其他提交者如何执行测试。

First of all thanks for showing interest in contributing to October CMS, 首先,感谢您有兴趣为10月的CMS做贡献,

I would say you don't need to modify a single line. 我会说您不需要修改任何一行。

first let's be specific and we only need to test octobercms/library as we don't need to make things complex 首先让我们具体一点,我们只需要测试octobercms/library因为我们不需要使事情复杂化

let's assume you have working local October CMS based website on your machine. 假设您的计算机上有本地十月CMS网站。

  1. now go to vendor\\october\\rain folder as october lib resides there. 现在转到vendor\\october\\rain october lib所在的vendor\\october\\rain文件夹。 (inside termial) (在终端内)

  2. now do composer install there 现在在这里做composer install

if you find any dependency issue in installation.(Then ONLY follow this) , I found some problem here some dependency issue so, i need to remove this 2 dependencies from composer.json 如果您在安装中发现任何依赖关系问题(然后仅遵循此步骤) ,则在这里发现了一些依赖关系问题,因此我需要从composer.json删除这2个依赖关系

if you find same issue then : go to "require-dev" section -> remove 如果您发现相同的问题,则:转到“ require-dev”部分->删除

1. "illuminate/routing": "5.5.*" 1. “照亮/路由”:“ 5.5。*”

2. "swiftmailer/swiftmailer": "~5.1" 2. “ swiftmailer / swiftmailer”:“〜5.1”

3. now try to install composer install again. 3.现在尝试重新安装composer install

  1. when its done. 当它完成。

  2. just got vendor\\october\\rain\\tests directory (inside termial) 刚获得了vendor\\october\\rain\\tests目录(在终端内)

  3. execute command for windows .\\..\\vendor\\bin\\phpunit.bat and for linux/mac ./../vendor/bin/phpunit 对Windows .\\..\\vendor\\bin\\phpunit.bat 和linux / mac ./../vendor/bin/phpunit执行命令

  4. it will automatically detect all the stuff and execute tests for you. 它会自动检测所有东西并为您执行测试。

if you face any issue please add comment. 如果您遇到任何问题,请添加评论。

https://github.com/octobercms/library/wiki/How-To-Use-Unit-Tests-%3F https://github.com/octobercms/library/wiki/How-To-Use-Unit-Tests-%3F

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM