在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:akoebbe/php_koans开源软件地址:https://github.com/akoebbe/php_koans开源编程语言:PHP 99.3%开源软件介绍:PHP KoansPHP Koans is heavily based on Greg Malcolm's Python Koans, which is based on Edgecase's Ruby Koans. Much credit to both projects. Thank you! PHP Koans is an interactive tutorial for learning the PHP programming language by making tests pass. Most tests are fixed by filling the missing parts of assert functions. Eg: $this->assertEquals(__, 1+2); which can be fixed by replacing the $this->assertEquals(3, 1+2); Occasionally you will encounter some failing tests that are already filled out. In these cases, you will need to finish implementing some code to progress. For example, there is an exercise for writing some code that will tell you if a triangle is equilateral, isosceles or scalene. As well as being a great way to learn some PHP, it is also a good way to get a taste of Test Driven Development (TDD). Downloading PHP KoansPHP Koans is available through git on Github: https://github.com/akoebbe/php_koans or Installing PHP KoansAside from downloading or checking out the latest version of PHP Koans, you need to install the PHP interpreter. PHP Koans was written using PHP 7.1. It is recommended that you use PHP 7.1+, though it may work in earlier versions, don't hold your breath. Only the command line interface (CLI) for PHP is needed as we will not be testing web development. Windows
macOSmacOS bundles PHP, so you may not need to do anything depending on the version installed. To check which version you have open the Terminal app and type
If you see version 7.1 or higher, you're good to go! If not, then you will want to install a newer version with Homebrew. Homebrew
LinuxIf you are running Linux, you will use your distributions package manager to install PHP. A few common distribution methods: Debian/Ubuntu (and variants)
Fedora
If that version is outdated, you can use Remi's Repository to install a newer version. See section 2.1 on Remi's site Arch
DockerizationIf you prefer not to install php in your system, you can use a docker container. To build the image run a terminal, go to the php_koans folder and run:
Every time you want to execute the suite run:
Getting StartedFrom a *nix terminal or windows command prompt go to the php_koans folder and run:
In my I fire up my Terminal app and run this: Apparently, a test failed:
It also tells me exactly where the problem is, it's an assert on line 15 of .\koans\AssertKoans.php. This one is easy, just change PHPUnitThis koans project uses Sebastian Bergmann's wonderful PHPUnit command (source code). The PHAR binary is included in this project for convenience and to lower the setup curve. It has been renamed from Work in ProgressThis project and document are a work in progress. There is still much to do and many people to thank. Please bear with me (and contribute!) as the project progresses. These are the list of koans from Python Koans to be ported over to PHP Koans.
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论