public function test_finding_a_product_by_slug()
 {
     $repo = new ProductRepository();
     $product = Factory::create(new Product());
     $response = $repo->findBySlug($product->slug);
     $this->assertEquals($product->id, $response->id);
     $this->setExpectedException('Illuminate\\Database\\Eloquent\\ModelNotFoundException');
     $response = $repo->findBySlug('foofoofoo');
 }
 /**
  * Fetch the product details
  *
  * @return void
  */
 public function onRun()
 {
     if ($this->property('use_inventory_selector')) {
         $this->addJs('components/product/assets/compiled/inventory-selector.min.js');
     }
     try {
         $slug = $this->property('slug');
         $this->product = $this->repository->findBySlug($slug);
     } catch (ModelNotFoundException $e) {
         return $this->controller->run('404');
     }
 }