Talking Drupal Newsletter #446
#446 Test Driven Development
Today we are talking about Test Driven Development, Why it’s important, and How it improves development with guest Alexey Korepov. We’ll also cover Test Helpers as our module of the week.
Topics
What does the term Test Driven Development (TDD) mean
Does Drupal make use of TDD
What makes TDD different from other methods of Development
Do you have to change your way of thinking
What are some good resources to learn TDD
Do you have any pointers for teams looking to get started
Are certain kinds of projects better suited to TDD
How have dev teams adapted to TDD
Any advice on environment setup
Any special tools
Resources
Guests
Alexey Korepov - korepov.pro Murz
Hosts
Nic Laflin - nLighteneddevelopment.com nicxvan
Martin Anderson-Clutz - mandclu
Matt Glaman - mglaman.dev mglaman
Module of the Week
with Martin Anderson-Clutz - mandclu
The module provides API to significantly simplify writing Drupal unit tests! Using the API reduces the amount of code in your unit tests to cover all the logic of tested functions, using provided stubs of Drupal services.
Skills Upgrade #7
Welcome back to “Skills Upgrade” a Talking Drupal mini-series following the journey of a D7 developer learning D10. This is episode 7.
Topics
Review Chad's goals for the previous week
Test Example
Set up phpunit.xml
Start with FrontPageLinkTest.php
Review Chad's questions
In the testing_example module, the file "src/Controller/TestingExampleController.php" has a function for simpletestDescription(). Is this an outdated artifact that should have been removed at some point? The module itself doesn't appear to use Simpletest elsewhere and appears to only rely on PHPUnit.
What do you recommend for the minimal code structure to include for any given test type? Is the Testing Example module an ideal model or are there other resources I should review? The testing reference from Selwyn was helpful.
In the "FrontPageLinkDependenciesTest.php" setUp() function, the createContentType() function is called without specifying the type. Is that set somewhere else? I may have overlooked it. Nevermind—it's set using randomMachineName() in the createContentType() function.
Is there anything extra or standard to write in tests for drupal.org?
Tasks for the upcoming week
Smart Date - Martin (maintainer) to review promptly, I've already chatted with him about it. Create a new functional test: "submit a range with an end time before the start and validate that an error is returned"
Create an issue in the Smart Date queue and assign to yourself.
Create an issue fork.
Check out the issue fork locally.
Write (and test) the test locally.
Commit and push to the issue fork.
Mark issue as "Needs review".
Ask someone to review - if all looks good, the reviewer will mark as RBTC.
Resources
Chad's Drupal 10 Learning Curriclum & Journal
Chad's Drupal 10 Learning Notes
The Linux Foundation is offering a discount of 30% off e-learning courses, certifications and bundles with the code, all uppercase DRUPAL24 and that is good until June 5th
https://training.linuxfoundation.org/certification-catalog/
Hosts
AmyJune Hineline - @volkswagenchick
Guests
Chad Hester - chadkhester.com @chadkhest
Mike Anello - DrupalEasy.com @ultimike
Show News
You can connect with Talking Drupal at DrupalCon.
Martin at the Acquia Booth & Community Summit
John at the EPAM Booth & Community Summit
Ivan at the Community Summit
Upcoming Episodes
#448 Matt's show. Recording April 23.
#449 Agile Methodologies with Chris Wells. Recording April 30.
#450 Exam / Certification Prep. with Martin and Chad Hester. Recording May 3.
#451 Just Say Drupal with Ivan Stegic. Recording May 14.
Submit your questions on the #TalkingDrupal channel on Drupal Slack or @TaklingDrupal on Twitter, @TalkingDrupal@Drupal.Community on Mastodon.
“ The drop times is looking for volunteers to cover the upcoming DrupalCon Portland. If you are planning to attend and you are able to help with taking photos, videos or writing articles. We welcome you to join our team of volunteers for the Drop Times. You can reach out to us at thedroptimes.com/contact or at the droptimes on X.
Thanks in advance for your help.”
— The Drop Times
Minifigure of the Week
by Nic Laflin
71045-11
This week I would like to share 71045-1 Fierce Barbarian! This is the 11th minifigure in the 25th series of collectible minifigures. Released in 2024, this figure has a great sword! The headband reminds me of Conan the barbarian.
Contact Us
@talkingdrupal on Twitter
@talkingdrupal@drupal.community on Mastodon
#talkingdrupal on Drupal Slack