Email the Author

You can use this page to email Kenji Suzuki and Mat Whitney about CodeIgniter Testing Guide.

Please include an email address so the author can respond to your query

This message will be sent to Kenji Suzuki and Mat Whitney

This site is protected by reCAPTCHA and the Google  Privacy Policy and  Terms of Service apply.

About the Book

Who Should Read This Book?

This book is for PHP developers who don't know Automated Testing or Unit Testing, or for those looking for help testing CodeIgniter applications.

If one or more of the lines below sounds familiar, this book is perfect for you!

  • I have never written test code.
  • I want to write test code, but I don't know how.
  • I tried to write test code in the past, but I couldn't quite figure it out.

Table of Contents

Chapter 1: What is Automated Testing?

Let's begin learning about automated testing. First we will explore the basic concepts of automated testing. We will find out why and what you should test. At the same time, I will explain the ideas and testing policies used by this book.

Chapter 2: Setting Up the Testing Environment

To run tests in your PHP environment, you will need to install some additional software. For this book, this includes CodeIgniter, PHPUnit and a tool which acts as a bridge between them, ci-phpunit-test.

Chapter 3: Test Jargon

We define test jargon here. One of the annoying and confusing things in testing is the new vocabulary required to understand it. By the end of this chapter we'll help you understand the difference between Unit, Integration, and System testing; Functional and Acceptance testing; Fixtures and Mocks; and more.

Chapter 4: PHPUnit Basics

IIn this chapter, we will learn the basics of PHPUnit. We will run PHPUnit and learn how to configure it. After that, we will study PHPUnit conventions and write our first test. We also cover PHPUnit functionality, data providers, fixtures, and assertions.

Chapter 5: Testing a Simple MVC Application

You've already learned how to write test code, so here we will write tests for a CodeIgniter Tutorial application. We will write tests for a controller and a model. In this chapter, we will use the database for model testing.

Chapter 6: Unit Testing for Models

We will learn more about testing models. We will write tests for models without using the database. To do this, we will learn about PHPUnit mock objects.

Chapter 7: Testing Controllers

We will learn more about testing controllers in this and the next two chapters. In this chapter, we will write tests for a controller for reviewing, and write tests with mocking models. We also will write test cases for authentication and redirects.

Chapter 8: Unit Testing CLI Controllers

We will continue learning to write tests for controllers. In this chapter, we will write unit tests for controllers, and learn about monkey patching.

Chapter 9: Testing REST Controllers

In this chapter, we will learn about testing REST controllers. You will learn how to send (emulate) requests with methods other than GET and POST.

Chapter 10: Browser Testing with Codeception

In previous chapters, we have been using PHPUnit. In this chapter, we will learn about another testing tool. We will install Codeception, learn to configure it, and write tests which work with the web browser.


About the Authors

Kenji Suzuki’s avatar Kenji Suzuki

@kenji_s

Kenji Suzuki is a contributor to CodeIgniter. He is the author of ci-phpunit-test and my-ciunit, and a co-author of the first CodeIgniter book by a Japanese famous IT book publisher, "CodeIgniter tettei nyumon". He is a PHP expert, Certified PHP 5 Engineer Expert by Engineer Certification Corporation for PHP.

Mat Whitney’s avatar Mat Whitney

Mat Whitney is a contributor to CodeIgniter and currently maintains Bonfire, a projects started by Lonnie Ezell to provide a core set of tools for CodeIgniter projects. Mat is also the technical reviewer of Lonnie's book, Practical CodeIgniter 3.

Logo white 96 67 2x

Publish Early, Publish Often

  • Path
  • There are many paths, but the one you're on right now on Leanpub is:
  • Codeigniter-testing-guide › Email Author › New
    • READERS
    • Newsletters
    • Weekly Sale
    • Monthly Sale
    • Store
    • Home
    • Redeem a Token
    • Search
    • Support
    • Leanpub FAQ
    • Leanpub Author FAQ
    • Search our Help Center
    • How to Contact Us
    • FRONTMATTER PODCAST
    • Featured Episode
    • Episode List
    • MEMBERSHIPS
    • Reader Memberships
    • Department Reader Memberships
    • Author Memberships
    • Your Membership
    • COMPANY
    • About
    • About Leanpub
    • Blog
    • Contact
    • Press
    • Essays
    • AI Services
    • Imagine a world...
    • Manifesto
    • More
    • Partner Program
    • Causes
    • Accessibility
    • AUTHORS
    • Write and Publish on Leanpub
    • Create a Book
    • Create a Bundle
    • Create a Course
    • Create a Track
    • Testimonials
    • Why Leanpub
    • Services
    • TranslateAI
    • TranslateWord
    • TranslateEPUB
    • PublishWord
    • Publish on Amazon
    • CourseAI
    • GlobalAuthor
    • Marketing Packages
    • IndexAI
    • Author Newsletter
    • The Leanpub Author Update
    • Author Support
    • Author Help Center
    • Leanpub Authors Forum
    • The Leanpub Manual
    • Supported Languages
    • The LFM Manual
    • Markua Manual
    • API Docs
    • Organizations
    • Learn More
    • Sign Up
    • LEGAL
    • Terms of Service
    • Copyright Policy
    • Privacy Policy
    • Refund Policy

*   *   *

Leanpub is copyright © 2010-2025 Ruboss Technology Corp.
All rights reserved.

This site is protected by reCAPTCHA
and the Google  Privacy Policy and  Terms of Service apply.

Leanpub requires cookies in order to provide you the best experience. Dismiss