/** * Tests the update function in the SupplierController * @depends testStore * @param void * @return void */ public function testDelete() { $this->be(User::first()); $this->runStore($this->input); $supplier = new SupplierController(); $supplier->delete(1); $supplierDeleted = Supplier::withTrashed()->find(1); $this->assertNotNull($supplierDeleted->deleted_at); }
/** * Checks if the parameter is a valid supplier id * @param $id int * @return Supplier object if $id is found, otherwise false */ private function __checkExistence($id) { if (!is_null($id) && $id != '') { $supplier = Supplier::withTrashed()->find($id); if (is_null($supplier)) { return false; } return $supplier; } return false; }