/** * Testing the visitor mechanism * @param Store\AmazonStore $store * @param array $products * @dataProvider storeProvider */ public function testVisitorMechanism($store, $products) { $this->assertNotSame($products, $store->getProducts()); $store->acceptVisitor($this->storeVisitor); $this->assertSame($products, $store->getProducts()); }
/** * Visit the Amazon store and sort the products (descending sort). * @param Store\AmazonStore $store */ public function visitAmazon(Store\AmazonStore $store) { $products = $store->getProducts(); rsort($products); $store->setProducts($products); }