public function testDestroy() { $this->testCreateNew(); //Create new first $pricelist = Pricelist::find('1'); $pricelist->delete(); $result = Pricelist::find('1'); $this->assertTrue($result == null); }
public function testStoreMediasSuccess() { // Add membership $membership = new Membership(); $membership->name = "Gold"; $membership->rank = 5; $membership->save(); // Add media $media = new Media(); $media->name = 'This is the title'; $media->path = 'path/to/somewhere'; $media->sku = 'UNIQUESKU001'; $media->short_description = 'This is the body'; $media->category_id = 1; $media->active = true; $result = $media->save(); $input = array('name' => 'This is title', 'short_description' => 'This is body', 'cn_name' => 'CN name', 'cn_short_description' => 'CN short body', 'category_id' => 1, 'sku' => 'UNIQUESKU001', 'price_1' => 99.98999999999999, 'media_checkbox' => array('1_1')); $this->call('POST', '/admin/modules/store', $input); $this->assertRedirectedTo('/admin/modules'); $pricelist = Pricelist::where('module_id', 1)->where('membership_id', 1)->first(); $this->assertTrue($pricelist != null); $this->assertTrue($pricelist->module_id == 1); $this->assertTrue($pricelist->membership_id == 1); $this->assertTrue($pricelist->price == 99.98999999999999); $modMediaMembership = ModuleMediaMembership::where('module_id', 1)->where('membership_id', 1)->where('media_id', 1)->first(); $this->assertTrue($modMediaMembership != null); }