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 trialAnna Foldvari
PHP Development Techdegree Graduate 30,034 PointsI get an error message to add the data array when I create the new Artwork object.
So I am not sure what the problem as I add the array for the new object. I also tried just to pass $data to it. Not sure whether that was expected but in both ways it is giving me the same error message that the array is not added to the object.
<?php
use PHPUnit\Framework\TestCase;
class ArtworkTest extends TestCase
{
protected $artwork;
protected function setUp(): void
{
$this->artwork = new Artwork([
'title' => 'mona lisa',
'artist' => 'leonardo da vinci',
'century' => '15th century',
'movement' => 'renaissance',
'location' => 'the louvre (paris, france)',
'type' => 'painting',
'medium' => 'oil on canvas'
]);
}
/** @test */
function hasTitle()
{
$this->assertEquals(
"Mona Lisa",
$this->artwork->getTitle()
);
}
/** @test */
function isAtTheLouvre()
{
$this->assertStringContainsStringIgnoringCase(
'Louvre',
$this->artwork->getLocation()
);
}
//more tests
}