Book Image

Learning PHP 7

By : Antonio L Zapata (GBP)
Book Image

Learning PHP 7

By: Antonio L Zapata (GBP)

Overview of this book

PHP is a great language for building web applications. It is essentially a server-side scripting language that is also used for general purpose programming. PHP 7 is the latest version with a host of new features, and it provides major backwards-compatibility breaks. This book begins with the fundamentals of PHP programming by covering the basic concepts such as variables, functions, class, and objects. You will set up PHP server on your machine and learn to read and write procedural PHP code. After getting an understanding of OOP as a paradigm, you will execute MySQL queries on your database. Moving on, you will find out how to use MVC to create applications from scratch and add tests. Then, you will build REST APIs and perform behavioral tests on your applications. By the end of the book, you will have the skills required to read and write files, debug, test, and work with MySQL.
Table of Contents (17 chapters)
Learning PHP 7
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface
Index

Testing with a browser using Mink


So far, we have been able to write acceptance tests for a script, but most of you are reading this book in order to write nice and shiny web applications. How can you take advantage of acceptance tests then? It is time to introduce the second PHP tool of this chapter: Mink.

Mink is actually an extension of Behat, which adds implementations of several steps related to web browser testing. For example, if you add Mink to your application, you will be able to add scenarios where Mink will launch a browser and click or type as requested, saving you a lot of time and effort in manual testing. However, first, let's take a look at how Mink can achieve this.

Types of web drivers

Mink makes use of web drivers—that is, libraries that have an API that allows you to interact with a browser. You can send commands, such as go to this page, click on this link, fill this input field with this text, and so on, and the web driver will translate this into the correct instruction...