public function testCompactProperties() { $expectName = "Best movie"; $expectPrice = "15"; $myProduct = new AcProduct(); $myProduct->setName($expectName); $myProduct->setPrice($expectPrice); $compactedArray = compact_property($myProduct, 'name', 'price'); $this->assertArrayHasKey('name', $compactedArray); $this->assertArrayHasKey('price', $compactedArray); $this->assertEquals($expectName, $compactedArray['name']); $this->assertEquals($expectPrice, $compactedArray['price']); }