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 Testing Existing Projects Setup Fixure

Cristina Rosales
Cristina Rosales
10,929 Points

Figured it out, but still confused.

So here is the answer: <?php use PHPUnit\Framework\TestCase;

class ArtworkTest extends TestCase { // add your code here protected $artwork; protected $data = [ 'title' => 'mona lisa', 'artist' => 'leonardo da vinci', 'century' => '15th century', 'movement' => 'renaissance', 'location' => 'the louvre (paris, france)', 'type' => 'painting', 'medium' => 'oil on canvas' ]; protected function setUp() : void { $this->artwork = new Artwork($data->title); } /** @test */ function hasTitle() { $this->assertEquals( "Mona Lisa", $this->artwork->getTitle() ); }

/** @test */
function isAtTheLouvre()
{
    $this->assertStringContainsStringIgnoringCase(
        'Louvre', 
        $this->artwork->getLocation()
    );
}

//more tests

}

What doesn't make sense to me is the lack of setting up how a variable that represents an array, protected or not, winds up needing to have the dollarsign before it in the argument of the instantiation of the Artwork class so that we get 'mona lisa' as the title.

Moreover, my attempts to set up anything for the Louvre are not needed apparently. Plus, I would need access to the actual class of Artwork file to see what the function is for setting the location. I absolutely HATE when there are leaps in knowledge like this. I've got some pretty bad trauma from coding and when I run into things like this I start feeling like I'm getting gaslit.