Пример #1
0
 /**
  *
  */
 public function it_shoud_reindex_on_model_delete()
 {
     /**
      *
      * Expectation
      *
      */
     Facade::clearResolvedInstances();
     Queue::shouldReceive('push')->with('Iverberk\\Larasearch\\Jobs\\DeleteJob', ['Husband:2'])->once();
     Queue::shouldReceive('push')->with('Iverberk\\Larasearch\\Jobs\\ReindexJob', ['Wife:2', 'Child:2', 'Toy:2'])->once();
     Config::shouldReceive('get')->with('/^larasearch::reversedPaths\\..*$/', array())->once()->andReturn(['', 'wife', 'children', 'children.toys']);
     $husband = \Husband::find(2);
     with(new Observer())->deleted($husband);
 }
Пример #2
0
 /**
  * @test
  */
 public function it_should_reindex_on_model_delete()
 {
     /**
      *
      * Expectation
      *
      */
     Facade::clearResolvedInstances();
     Queue::shouldReceive('push')->with('Menthol\\Flexible\\Jobs\\DeleteJob', ['Husband:2'])->once();
     $config = m::mock('Menthol\\Flexible\\Config');
     App::shouldReceive('make')->with('Menthol\\Flexible\\Config')->andReturn($config);
     $config->shouldReceive('get')->with('/^reversedPaths\\..*$/', [])->once()->andReturn(['', 'wife', 'children', 'children.toys']);
     Queue::shouldReceive('push')->with('Menthol\\Flexible\\Jobs\\ReindexJob', ['Wife:2', 'Child:2', 'Toy:2'])->once();
     $husband = \Husband::find(2);
     with(new Observer())->deleted($husband);
 }