WooHoo! You did it! You made it through this lab. In doing so, you setup your testing environment, learned a few new things about Composer, dove into the formula for figuring out what to test, and wrote real unit and integration tests. Congratulations for completing this lab!
Labs
Labs are hands-on coding projects that you build along with Tonya as she explains the code, concepts, and thought processes behind it. You can use the labs to further your code knowledge or to use right in your projects. Each lab ties into the Docx to ensure you have the information you need.
Each lab is designed to further your understanding and mastery of code. You learn more about how to think about its construction, quality, maintainability, programmatic and logical thought, and problem-solving. While you may be building a specific thing, Tonya presents the why of it to make it adaptable far beyond that specific implementation, thereby giving you the means to make it your own, in any context.
Setup Local’s Web Server
Notes | Transcript | Playlist Notes Are you running Local by Flywheel, like me? If no, you can skip this episode. But if yes, then in this episode, you and I will install the packages we need as well as get WordPress setup. It’s really easy as Kees Meijer already has the bash script and instructions ready for you. Click here to get the script. Transcript
Setup Test Shortcuts in Composer
Notes | Transcript | Code | Playlist Notes In this episode, you’ll be: Installing all of the dependencies specified by running composer install. Fixing a namespace error in the composer.json file. Adding in the integration tests PSR-4 configuration. Adding in the scripts, which will make your testing job so much easier. Transcript Code
Create the Composer.json File
Notes | Transcript | Code | Playlist Notes In this episode, you and I will create a composer.json file to configure all of the dependencies we will need for our testing suites. Transcript Code
Test Assertions
Notes | Transcript | Code | Playlist Notes A great way to learn which assertions to use for your tests is to take the equivalent comparative code and find the assertion that does the comparison work for you. In this episode, I’m going to challenge you to do just that. I want you to take our test sample assertions, which are all assertTrue(), look at the comparison code, and figure out which assertion can replace that code. You’ll be using the PHPUnit manual. Then together, you and I will walk through the process together. We’ll look at the different assertions […]
How Testing Benefits You
Notes | Transcript | Code | Playlist Notes Before we can really dive into testing, I think any conversation about integration testing into workflow has to start with “how it benefits you.” Testing requires more work from you upfront, but saves you time and money later. The benefits are huge to your company, clients, and you. Let’s talk about why and what you get. In this episode, I’ll show you the benefits of testing by showing you a real world framework that had a bug in it. As I was writing tests for it, I found a bug, one that […]
Unit Tests – Write Real Tests
Notes | Transcript | Code | Playlist Notes Ready to map out and then write real unit tests? Let’s do that together. You and I will be writing all of the scenarios for the function beans_get(). Step-by-step, we’ll walk through the process of identifying the scenarios and then building a test to validate each one. Resources Type casting beans_get Transcript Code
Test Basics
Notes | Transcript | Code | Playlist Notes In this episode, you’ll dissect a sample test class while you learn about the terminology, structure, naming, intent, and more. Transcript Code
Configure PHPUnit for Both Test Suites
Code | Notes | Transcript | Playlist Code Notes In this episode, you’ll copy and paste the two XML files into your project. Then we’ll walk through the files and explain the configuration as well as the test suite strategies. Transcript
Unit Tests – Bootstrap
Notes | Transcript | Code | Playlist Notes In this episode, you’ll be creating the tasks within the unit tests’ bootstrap file. Transcript Code