Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Preview
Start a free Courses trial
to watch this video
Test for the Final Rule
This video doesn't have any notes.
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
The final rule to add to our convert
method is words that start with a vowel.
0:00
These words do not have
any letters moved around.
0:06
They just add the string ay to the end.
0:10
We can duplicate one of our other tests.
0:14
And we'll change the name to
convertStartingVowelWordToPigLatin().
0:20
We'll need a new word
that starts with a vowel.
0:29
How about unit?
0:32
Our expected results will be unitay,
0:35
and we run our code.
0:40
The force test fails as expected.
0:44
By looking at the results,
we can see that the convert
0:46
method is moving the first
letter U to the end of the word.
0:50
Why don't you give it a try and
see if you can make the last test pass.
0:54
You can approach this in the same way
as we did the consonant clusters.
0:59
This time using the vowels A,
E, I, O, and U.
1:03
Test-driven development can seem
overwhelming when you're first getting
1:10
started with testing.
1:13
And if you already have an application,
it's not really feasible.
1:15
You don't need to take an all or
nothing approach.
1:19
One test is better than no test.
1:23
And each method that you test
leaves your code better and
1:25
more documented than it was before.
1:29
You can add additional tests while you're
fixing bugs or adding new features.
1:32
In the next section,
1:37
we'll look at how we can use PHP
unit to test an existing project.
1:38
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up