fixed some tests and added more
This commit is contained in:
		@@ -8,23 +8,23 @@ use Tests\Feature\FeatureTestCase;
 | 
			
		||||
 | 
			
		||||
class ItemsTest extends FeatureTestCase
 | 
			
		||||
{
 | 
			
		||||
	public function testItShouldBeShowTheItemsPage()
 | 
			
		||||
	public function testItShouldSeeItemListPage()
 | 
			
		||||
	{
 | 
			
		||||
		$this->loginAs()
 | 
			
		||||
			->get(route('items.index'))
 | 
			
		||||
			->assertStatus(200)
 | 
			
		||||
			->assertSee('Items');
 | 
			
		||||
			->assertSeeText(trans_choice('general.items', 2));
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public function testItShouldBeShowCreateItemPage()
 | 
			
		||||
	public function testItShouldSeeItemCreatePage()
 | 
			
		||||
	{
 | 
			
		||||
		$this->loginAs()
 | 
			
		||||
			->get(route('items.create'))
 | 
			
		||||
			->assertStatus(200)
 | 
			
		||||
			->assertSee('New Item');
 | 
			
		||||
			->assertSeeText(trans('general.title.new', ['type' => trans_choice('general.items', 1)]));
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public function testItShouldStoreAnItem()
 | 
			
		||||
	public function testItShouldCreateItem()
 | 
			
		||||
	{
 | 
			
		||||
		$this->loginAs()
 | 
			
		||||
			->post(route('items.store'), $this->getItemRequest())
 | 
			
		||||
@@ -34,7 +34,7 @@ class ItemsTest extends FeatureTestCase
 | 
			
		||||
		$this->assertFlashLevel('success');
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public function testItShouldEditItem()
 | 
			
		||||
	public function testItShouldSeeItemUpdatePage()
 | 
			
		||||
	{
 | 
			
		||||
        $item = Item::create($this->getItemRequest());
 | 
			
		||||
 | 
			
		||||
@@ -44,6 +44,22 @@ class ItemsTest extends FeatureTestCase
 | 
			
		||||
			->assertSee($item->name);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public function testItShouldUpdateItem()
 | 
			
		||||
	{
 | 
			
		||||
		$request = $this->getItemRequest();
 | 
			
		||||
 | 
			
		||||
		$item = Item::create($request);
 | 
			
		||||
 | 
			
		||||
        $request['name'] = $this->faker->text(15);
 | 
			
		||||
 | 
			
		||||
		$this->loginAs()
 | 
			
		||||
			->patch(route('items.update', $item->id), $request)
 | 
			
		||||
			->assertStatus(302)
 | 
			
		||||
			->assertRedirect(route('items.index'));
 | 
			
		||||
 | 
			
		||||
		$this->assertFlashLevel('success');
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public function testItShouldDeleteItem()
 | 
			
		||||
	{
 | 
			
		||||
		$item = factory(Item::class)->create();
 | 
			
		||||
@@ -62,15 +78,15 @@ class ItemsTest extends FeatureTestCase
 | 
			
		||||
 | 
			
		||||
        return [
 | 
			
		||||
            'company_id' => $this->company->id,
 | 
			
		||||
            'name' => $this->faker->title,
 | 
			
		||||
            'sku' => $this->faker->languageCode,
 | 
			
		||||
            'name' => $this->faker->text(15),
 | 
			
		||||
            'sku' => $this->faker->unique()->ean8,
 | 
			
		||||
            'picture' => $picture,
 | 
			
		||||
            'description' => $this->faker->text(100),
 | 
			
		||||
            'purchase_price' => $this->faker->randomFloat(2,10,20),
 | 
			
		||||
            'sale_price' => $this->faker->randomFloat(2,10,20),
 | 
			
		||||
            'purchase_price' => $this->faker->randomFloat(2, 10, 20),
 | 
			
		||||
            'sale_price' => $this->faker->randomFloat(2, 10, 20),
 | 
			
		||||
            'quantity' => $this->faker->randomNumber(2),
 | 
			
		||||
            'category_id' => $this->company->categories()->first()->id,
 | 
			
		||||
            'tax_id' => $this->company->taxes()->first()->id,
 | 
			
		||||
            'category_id' => $this->company->categories()->type('item')->first()->id,
 | 
			
		||||
            'tax_id' => $this->company->taxes()->enabled()->first()->id,
 | 
			
		||||
            'enabled' => $this->faker->boolean ? 1 : 0
 | 
			
		||||
        ];
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user