Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialMuhammed Akeel Jagot
Front End Web Development Techdegree Graduate 30,674 PointsTask 2 of 3: Add an "Addition" method, either annotated or named for a test.
I've tried multiple ways to try to solve this, rewatching the video, changing placements, changing uppercase and lowercase. Doesn't seem to work. May I have some help, please?
<?php
class MathTest extends PHPUnit\Framework\TestCase
{
/** @test */
function testAddition
{
}
}
?>
1 Answer
Jennifer Nordell
Treehouse TeacherHi there, Muhammed Akeel Jagot ! It looks like you're doing great! However, the code you have is missing something that is resulting in a syntax error. Namely, it is missing a set of parentheses. To declare a function, it must include parentheses:
function testAddition() {
}
Hope this helps!
Benneth Crow
95 PointsBenneth Crow
95 Pointsuse PHPUnit\Framework\TestCase; class MathTest extends TestCase { /** test / function testAddition() { /$result = 2 + 2; $this->assertEquals(4, $result);*/ } }