PHP Objects, Patterns, and Practice- P10

PHP Objects, Patterns, and Practice- P10: This book takes you beyond the PHP basics to the enterprise development practices used by professional programmers. Updated for PHP with new sections on closures, namespaces, and continuous integration, this edition will teach you about object features such as abstract classes, reflection, interfaces, and error handling. You’ll also discover object tools to help you learn more about your classes, objects, and methods. | CHAPTER 20 CONTINUOUS INTEGRATION Chapter 18 to illustrate PHPUnit. I m going to name it userthing because it s a thing with a User object in it. First of all here is a breakdown of my project directory. See Figure 20-1. Figure 20-1. Part of a sample project to illustrate CI As you can see I ve tidied up the structure a little adding some package directories. Within the code I ve supported the package structure with the use of namespaces. Now that I have a project I should add it to a version control system. CI and Version Control Version control is essential for CI. A CI system needs to acquire the most recent version of a project without human intervention at least once things have been set up . 429 CHAPTER 20 CONTINUOUS INTEGRATION You may have noticed that I moved the code for userthing into a directory named trunk. That s because I m going to import the project into Subversion and the branches tags and trunk directories are a useful convention in that system. Here s the import svn import file var local svn userthing -m first import And here s the checkout. svn checkout file var local svn userthing trunk userthing I covered Subversion in more detail in Chapter 17. Now that I have the a local version of my project I m going to change my working directory to src in order to try out the various tools that my CI implementation will require. cd userthing src Unit Tests Unit tests are the key to continuous integration. It s no good successfully building a project that contains broken code. I covered unit testing with PHPUnit in Chapter 18. If you re reading out of order though you ll want to install this invaluable tool before proceeding. pear channel-discover pear install phpunit Also in Chapter 18 I wrote tests for a version of the userthing code I ll be working with in this chapter. Here I run them once again to make sure my reorganization has not broken anything new. phpunit test PHPUnit by Sebastian Bergmann. Time 0 seconds

Không thể tạo bản xem trước, hãy bấm tải xuống
TÀI LIỆU MỚI ĐĂNG
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.