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 trial

PHP Getting Started with PHP Unit Testing Test Driven Development Start with Tests

Muhammed Akeel Jagot
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Muhammed Akeel Jagot
Front End Web Development Techdegree Graduate 30,674 Points

Task 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?

index.php
<?php
class MathTest extends PHPUnit\Framework\TestCase
{ 
  /** @test */
  function testAddition
  {
  }
}

?>

1 Answer

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Hi 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! :sparkles:

use PHPUnit\Framework\TestCase; class MathTest extends TestCase { /** test / function testAddition() { /$result = 2 + 2; $this->assertEquals(4, $result);*/ } }

  • adding parentheses does not pass as well