Skip to content

Commit

Permalink
cleanup test
Browse files Browse the repository at this point in the history
  • Loading branch information
iamgergo committed Feb 20, 2024
1 parent a1ec04a commit 68e6f6d
Showing 1 changed file with 0 additions and 37 deletions.
37 changes: 0 additions & 37 deletions tests/Validation/ValidationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@
namespace Cone\Bazar\Tests\Validation;

use Cone\Bazar\Models\Order;
use Cone\Bazar\Models\Product;
use Cone\Bazar\Models\Property;
use Cone\Bazar\Models\Variant;
use Cone\Bazar\Rules\Option;
use Cone\Bazar\Rules\TransactionAmount;
use Cone\Bazar\Rules\Vat;
use Cone\Bazar\Tests\TestCase;
Expand Down Expand Up @@ -43,37 +39,4 @@ public function test_validator_validates_transaction_amounts(): void
$v = new Validator($this->translator, ['amount' => 10000], ['amount' => [new TransactionAmount($order)]]);
$this->assertFalse($v->passes());
}

public function test_validator_validates_variant_options(): void
{
$property = Property::factory()->create(['name' => 'Material', 'slug' => 'material']);
$property->values()->create(['name' => 'Gold', 'value' => 'gold']);

$product = Product::factory()->create();
$product->propertyValues()->attach($property->values);

$variant = $product->variants()->save(Variant::factory()->make());
$variant->propertyValues()->attach($property->values);

$v = new Validator(
$this->translator,
['variation' => ['material' => 'silver']],
['variation' => [new Option($product)]]
);
$this->assertTrue($v->passes());

$v = new Validator(
$this->translator,
['variation' => ['material' => 'gold']],
['variation' => [new Option($product)]]
);
$this->assertFalse($v->passes());

$v = new Validator(
$this->translator,
['variation' => ['material' => 'gold']],
['variation' => [new Option($product, $variant)]]
);
$this->assertTrue($v->passes());
}
}

0 comments on commit 68e6f6d

Please sign in to comment.