-
Notifications
You must be signed in to change notification settings - Fork 376
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch '0.7' into chore/merge_07_to_08
- Loading branch information
Showing
53 changed files
with
473 additions
and
555 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
...es/admin/tests/Unit/Http/Livewire/Components/Settings/Product/ProductOptionCreateTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php | ||
|
||
namespace Lunar\Hub\Tests\Unit\Http\Livewire\Components\Settings\Product; | ||
|
||
use Illuminate\Foundation\Testing\RefreshDatabase; | ||
use Livewire\Livewire; | ||
use Lunar\Hub\Http\Livewire\Components\Settings\Product\Options\OptionsIndex; | ||
use Lunar\Hub\Models\Staff; | ||
use Lunar\Hub\Tests\TestCase; | ||
use Lunar\Models\Language; | ||
use Lunar\Models\ProductOption; | ||
|
||
class ProductOptionCreateTest extends TestCase | ||
{ | ||
use RefreshDatabase; | ||
|
||
public function setUp(): void | ||
{ | ||
parent::setUp(); | ||
|
||
Language::factory()->create([ | ||
'default' => true, | ||
'code' => 'en', | ||
]); | ||
} | ||
|
||
/** | ||
* @test | ||
* */ | ||
public function can_populate_product_option_data() | ||
{ | ||
$staff = Staff::factory()->create([ | ||
'admin' => true, | ||
]); | ||
|
||
LiveWire::actingAs($staff, 'staff') | ||
->test(OptionsIndex::class) | ||
->set('newProductOption.name.' . Language::getDefault()->code, 'Size') | ||
->call('createOption'); | ||
|
||
$this->assertDatabaseHas((new ProductOption())->getTable(), [ | ||
'name' => json_encode([Language::getDefault()->code => 'Size']), | ||
]); | ||
} | ||
} |
49 changes: 49 additions & 0 deletions
49
...min/tests/Unit/Http/Livewire/Components/Settings/Product/ProductOptionValueCreateTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<?php | ||
|
||
namespace Lunar\Hub\Tests\Unit\Http\Livewire\Components\Settings\Product; | ||
|
||
use Illuminate\Foundation\Testing\RefreshDatabase; | ||
use Livewire\Livewire; | ||
use Lunar\Hub\Http\Livewire\Components\Settings\Product\Options\OptionEdit; | ||
use Lunar\Hub\Models\Staff; | ||
use Lunar\Hub\Tests\TestCase; | ||
use Lunar\Models\Language; | ||
use Lunar\Models\ProductOption; | ||
use Lunar\Models\ProductOptionValue; | ||
|
||
class ProductOptionValueCreateTest extends TestCase | ||
{ | ||
use RefreshDatabase; | ||
|
||
public function setUp(): void | ||
{ | ||
parent::setUp(); | ||
|
||
Language::factory()->create([ | ||
'default' => true, | ||
'code' => 'en', | ||
]); | ||
} | ||
|
||
/** | ||
* @test | ||
* */ | ||
public function can_populate_product_option_data() | ||
{ | ||
ProductOption::factory(1)->create()->each(function ($option) { | ||
$staff = Staff::factory()->create([ | ||
'admin' => true, | ||
]); | ||
|
||
LiveWire::actingAs($staff, 'staff') | ||
->test(OptionEdit::class, ['productOption' => $option]) | ||
->set('newProductOptionValue.name.' . Language::getDefault()->code, 'Size') | ||
->call('createOptionValue'); | ||
|
||
$this->assertDatabaseHas((new ProductOptionValue())->getTable(), [ | ||
'product_option_id' => $option->id, | ||
'name' => json_encode([Language::getDefault()->code => 'Size']) | ||
]); | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.