Merge branch 'bagisto/master' into introduce-company-name-and-sales-tax-id-columns
This commit is contained in:
commit
e948b30e35
|
|
@ -334,7 +334,7 @@ return [
|
|||
'item-status' => 'Item Status',
|
||||
'item-ordered' => 'Ordered (:qty_ordered)',
|
||||
'item-invoice' => 'Invoiced (:qty_invoiced)',
|
||||
'item-shipped' => 'shipped (:qty_shipped)',
|
||||
'item-shipped' => 'Shipped (:qty_shipped)',
|
||||
'item-canceled' => 'Canceled (:qty_canceled)',
|
||||
'item-refunded' => 'Refunded (:qty_refunded)',
|
||||
'price' => 'Price',
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@
|
|||
|
||||
<div class="control-group">
|
||||
<label for="locale-{{ $locale->code }}">{{ $locale->name . ' (' . $locale->code . ')' }}</label>
|
||||
<input type="text" class="control" id="locale-{{ $locale->code }}" name="<?php echo $locale->code; ?>[name]" value="{{ old($locale->code)['name'] ?? $attribute->translate($locale->code)['name'] }}"/>
|
||||
<input type="text" class="control" id="locale-{{ $locale->code }}" name="<?php echo $locale->code; ?>[name]" value="{{ old($locale->code)['name'] ?? ($attribute->translate($locale->code)->name ?? '') }}"/>
|
||||
</div>
|
||||
|
||||
@endforeach
|
||||
|
|
@ -432,7 +432,7 @@
|
|||
@endif
|
||||
|
||||
@foreach (app('Webkul\Core\Repositories\LocaleRepository')->all() as $locale)
|
||||
row['{{ $locale->code }}'] = "{{ $option->translate($locale->code)['label'] }}";
|
||||
row['{{ $locale->code }}'] = "{{ $option->translate($locale->code)['label'] ?? '' }}";
|
||||
@endforeach
|
||||
|
||||
this.optionRows.push(row);
|
||||
|
|
|
|||
|
|
@ -304,6 +304,7 @@
|
|||
this.bundle_option_products.push({
|
||||
product: item,
|
||||
qty: 0,
|
||||
is_default: 0,
|
||||
sort_order: 0
|
||||
});
|
||||
}
|
||||
|
|
@ -348,9 +349,9 @@
|
|||
|
||||
this.bundle_option_products.forEach(function(product) {
|
||||
if (this_this.bundleOption.type == 'radio' || this_this.bundleOption.type == 'select') {
|
||||
product.is_default = product.id == productId ? 1 : 0;
|
||||
product.is_default = product.product.id == productId ? 1 : 0;
|
||||
} else {
|
||||
if (product.id == productId)
|
||||
if (product.product.id == productId)
|
||||
product.is_default = product.is_default ? 0 : 1;
|
||||
}
|
||||
});
|
||||
|
|
@ -381,7 +382,7 @@
|
|||
},
|
||||
|
||||
checkProduct: function($event) {
|
||||
this.$emit('onCheckProduct', this.product.id)
|
||||
this.$emit('onCheckProduct', this.product.product.id)
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -0,0 +1,15 @@
|
|||
<?php
|
||||
|
||||
/** @var \Illuminate\Database\Eloquent\Factory $factory */
|
||||
|
||||
use Faker\Generator as Faker;
|
||||
use Webkul\Attribute\Models\AttributeFamily;
|
||||
|
||||
$factory->define(AttributeFamily::class, function (Faker $faker) {
|
||||
return [
|
||||
'name' => $faker->word(),
|
||||
'code' => $faker->word(),
|
||||
'is_user_defined' => rand(0, 1),
|
||||
'status' => 0,
|
||||
];
|
||||
});
|
||||
|
|
@ -146,6 +146,10 @@ class Cart {
|
|||
if (is_string($cartProducts)) {
|
||||
$this->collectTotals();
|
||||
|
||||
if (! count($cart->all_items) > 0) {
|
||||
session()->forget('cart');
|
||||
}
|
||||
|
||||
throw new \Exception($cartProducts);
|
||||
} else {
|
||||
$parentCartItem = null;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,14 @@
|
|||
<?php
|
||||
|
||||
/** @var \Illuminate\Database\Eloquent\Factory $factory */
|
||||
|
||||
use Faker\Generator as Faker;
|
||||
use Webkul\Core\Models\SubscribersList;
|
||||
|
||||
$factory->define(SubscribersList::class, function (Faker $faker) {
|
||||
return [
|
||||
'email' => $faker->safeEmail,
|
||||
'is_subscribed' => $faker->boolean,
|
||||
'channel_id' => 1,
|
||||
];
|
||||
});
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
<?php
|
||||
|
||||
/** @var \Illuminate\Database\Eloquent\Factory $factory */
|
||||
|
||||
use Faker\Generator as Faker;
|
||||
use Webkul\Customer\Models\CustomerGroup;
|
||||
|
||||
$factory->define(CustomerGroup::class, function (Faker $faker) {
|
||||
$name = ucfirst($faker->word);
|
||||
return [
|
||||
'name' => $name,
|
||||
'is_user_defined' => $faker->boolean,
|
||||
'code' => lcfirst($name),
|
||||
];
|
||||
});
|
||||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace Webkul\Customer\Providers;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factory as EloquentFactory;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Illuminate\Routing\Router;
|
||||
use Webkul\Customer\Http\Middleware\RedirectIfNotCustomer;
|
||||
|
|
@ -30,4 +31,28 @@ class CustomerServiceProvider extends ServiceProvider
|
|||
{
|
||||
$this->app->make(EloquentFactory::class)->load($path);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register services.
|
||||
*
|
||||
* @return void
|
||||
* @throws \Illuminate\Contracts\Container\BindingResolutionException
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
$this->registerEloquentFactoriesFrom(__DIR__ . '/../Database/Factories');
|
||||
}
|
||||
|
||||
/**
|
||||
* Register factories.
|
||||
*
|
||||
* @param string $path
|
||||
*
|
||||
* @return void
|
||||
* @throws \Illuminate\Contracts\Container\BindingResolutionException
|
||||
*/
|
||||
protected function registerEloquentFactoriesFrom($path): void
|
||||
{
|
||||
$this->app->make(EloquentFactory::class)->load($path);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,20 @@
|
|||
<?php
|
||||
|
||||
/** @var \Illuminate\Database\Eloquent\Factory $factory */
|
||||
|
||||
use Faker\Generator as Faker;
|
||||
use Webkul\Product\Models\ProductReview;
|
||||
|
||||
$factory->define(ProductReview::class, function (Faker $faker, array $attributes) {
|
||||
if (!array_key_exists('product_id', $attributes)) {
|
||||
throw new InvalidArgumentException('product_id must be provided. You may use $I->haveProduct() to generate a product');
|
||||
}
|
||||
|
||||
return [
|
||||
'title' => $faker->words(5, true),
|
||||
'rating' => $faker->numberBetween(0, 10),
|
||||
'status' => 1,
|
||||
'comment' => $faker->sentence(20),
|
||||
'product_id' => $attributes['product_id'],
|
||||
];
|
||||
});
|
||||
|
|
@ -36,7 +36,7 @@ class Bundle extends AbstractType
|
|||
|
||||
/**
|
||||
* Bundle Option helper instance
|
||||
*
|
||||
*
|
||||
* @var BundleOption
|
||||
*/
|
||||
protected $bundleOptionHelper;
|
||||
|
|
@ -50,7 +50,7 @@ class Bundle extends AbstractType
|
|||
|
||||
/**
|
||||
* These blade files will be included in product edit page
|
||||
*
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $additionalViews = [
|
||||
|
|
@ -379,7 +379,7 @@ class Bundle extends AbstractType
|
|||
}
|
||||
|
||||
|
||||
if ($prices['from']['regular_price']['price'] != $prices['to']['regular_price']['price']
|
||||
if ($prices['from']['regular_price']['price'] != $prices['to']['regular_price']['price']
|
||||
|| $prices['from']['final_price']['price'] != $prices['to']['final_price']['price']) {
|
||||
|
||||
$priceHtml .= '<span style="font-weight: 500;margin-top: 1px;margin-bottom: 1px;display: block;">To</span>';
|
||||
|
|
@ -405,11 +405,13 @@ class Bundle extends AbstractType
|
|||
*/
|
||||
public function prepareForCart($data)
|
||||
{
|
||||
$data['bundle_options'] = array_filter($this->validateBundleOptionForCart($data['bundle_options']));
|
||||
|
||||
if (isset($data['bundle_options']))
|
||||
$data['bundle_options'] = array_filter($this->validateBundleOptionForCart($data['bundle_options']));
|
||||
|
||||
if (! isset($data['bundle_options']) || ! count($data['bundle_options']))
|
||||
return trans('shop::app.checkout.cart.integrity.missing_options');
|
||||
|
||||
|
||||
$products = parent::prepareForCart($data);
|
||||
|
||||
foreach ($this->getCartChildProducts($data) as $productId => $data) {
|
||||
|
|
@ -476,7 +478,7 @@ class Bundle extends AbstractType
|
|||
|
||||
return $products;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param array $options1
|
||||
|
|
@ -521,6 +523,8 @@ class Bundle extends AbstractType
|
|||
*/
|
||||
public function getAdditionalOptions($data)
|
||||
{
|
||||
$bundleOptionQuantities = $data['bundle_option_qty'];
|
||||
|
||||
foreach ($data['bundle_options'] as $optionId => $optionProductIds) {
|
||||
$option = $this->productBundleOptionRepository->find($optionId);
|
||||
|
||||
|
|
@ -531,11 +535,11 @@ class Bundle extends AbstractType
|
|||
continue;
|
||||
|
||||
$optionProduct = $this->productBundleOptionProductRepository->find($optionProductId);
|
||||
|
||||
|
||||
$qty = $data['bundle_option_qty'][$optionId] ?? $optionProduct->qty;
|
||||
|
||||
if (! isset($data['bundle_option_qty'][$optionId]))
|
||||
$data['bundle_option_qty'][$optionId] = $qty;
|
||||
$bundleOptionQuantities[$optionId] = $qty;
|
||||
|
||||
$labels[] = $qty . ' x ' . $optionProduct->product->name . ' ' . core()->currency($optionProduct->product->getTypeInstance()->getMinimalPrice());
|
||||
}
|
||||
|
|
@ -549,6 +553,8 @@ class Bundle extends AbstractType
|
|||
}
|
||||
}
|
||||
|
||||
$data['bundle_option_qty'] = $bundleOptionQuantities;
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,25 @@
|
|||
<?php
|
||||
|
||||
/** @var \Illuminate\Database\Eloquent\Factory $factory */
|
||||
|
||||
use Faker\Generator as Faker;
|
||||
use Webkul\Inventory\Models\InventorySource;
|
||||
|
||||
$factory->define(InventorySource::class, function (Faker $faker) {
|
||||
$code = $faker->unique()->word;
|
||||
return [
|
||||
'code' => $faker->unique()->word,
|
||||
'name' => $code,
|
||||
'description' => $faker->sentence,
|
||||
'contact_name' => $faker->name,
|
||||
'contact_email' => $faker->safeEmail,
|
||||
'contact_number' => $faker->phoneNumber,
|
||||
'country' => $faker->countryCode,
|
||||
'state' => $faker->state,
|
||||
'city' => $faker->city,
|
||||
'street' => $faker->streetAddress,
|
||||
'postcode' => $faker->postcode,
|
||||
'priority' => 0,
|
||||
'status' => 1,
|
||||
];
|
||||
});
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
<?php
|
||||
|
||||
/** @var \Illuminate\Database\Eloquent\Factory $factory */
|
||||
|
||||
use Faker\Generator as Faker;
|
||||
use Webkul\Sales\Models\Invoice;
|
||||
use Webkul\Sales\Models\Order;
|
||||
use Webkul\Sales\Models\OrderAddress;
|
||||
|
||||
$factory->define(Invoice::class, function (Faker $faker, array $attributes) {
|
||||
$subTotal = $faker->randomFloat(2);
|
||||
$shippingAmount = $faker->randomFloat(2);
|
||||
$taxAmount = $faker->randomFloat(2);
|
||||
|
||||
if (!$attributes['order_id']) {
|
||||
$attributes['order_id'] = function () {
|
||||
return factory(Order::class)->create()->id;
|
||||
};
|
||||
}
|
||||
|
||||
if (!$attributes['order_address_id']) {
|
||||
$attributes['order_address_id'] = function () use ($attributes) {
|
||||
return factory(OrderAddress::class)
|
||||
->create(['order_id' => $attributes['order_id']])
|
||||
->id;
|
||||
};
|
||||
}
|
||||
|
||||
return [
|
||||
'email_sent' => 0,
|
||||
'total_qty' => $faker->randomNumber(),
|
||||
'base_currency_code' => 'EUR',
|
||||
'channel_currency_code' => 'EUR',
|
||||
'order_currency_code' => 'EUR',
|
||||
'sub_total' => $subTotal,
|
||||
'base_sub_total' => $subTotal,
|
||||
'grand_total' => $subTotal,
|
||||
'base_grand_total' => $subTotal,
|
||||
'shipping_amount' => $shippingAmount,
|
||||
'base_shipping_amount' => $shippingAmount,
|
||||
'tax_amount' => $taxAmount,
|
||||
'base_tax_amount' => $taxAmount,
|
||||
'discount_amount' => 0,
|
||||
'base_discount_amount' => 0,
|
||||
'order_id' => $attributes['order_id'],
|
||||
'order_address_id' => $attributes['order_address_id'],
|
||||
];
|
||||
});
|
||||
|
||||
$factory->state(Invoice::class, 'pending', [
|
||||
'status' => 'pending',
|
||||
]);
|
||||
|
||||
$factory->state(Invoice::class, 'paid', [
|
||||
'status' => 'paid',
|
||||
]);
|
||||
|
||||
$factory->state(Invoice::class, 'refunded', [
|
||||
'status' => 'refunded',
|
||||
]);
|
||||
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
|
||||
/** @var \Illuminate\Database\Eloquent\Factory $factory */
|
||||
|
||||
use Faker\Generator as Faker;
|
||||
use Webkul\Customer\Models\Customer;
|
||||
use Webkul\Customer\Models\CustomerAddress;
|
||||
use Webkul\Sales\Models\Order;
|
||||
use Webkul\Sales\Models\OrderAddress;
|
||||
|
||||
$factory->define(OrderAddress::class, function (Faker $faker) {
|
||||
$customer = factory(Customer::class)->create();
|
||||
$customerAddress = factory(CustomerAddress::class)->create();
|
||||
|
||||
return [
|
||||
'first_name' => $customer->first_name,
|
||||
'last_name' => $customer->last_name,
|
||||
'email' => $customer->email,
|
||||
'address1' => $customerAddress->address1,
|
||||
'country' => $customerAddress->country,
|
||||
'state' => $customerAddress->state,
|
||||
'city' => $customerAddress->city,
|
||||
'postcode' => $customerAddress->postcode,
|
||||
'phone' => $customerAddress->phone,
|
||||
'address_type' => 'billing',
|
||||
'order_id' => function () {
|
||||
return factory(Order::class)->create()->id;
|
||||
},
|
||||
];
|
||||
});
|
||||
|
||||
$factory->state(OrderAddress::class, 'shipping', [
|
||||
'address_type' => 'shipping',
|
||||
]);
|
||||
|
|
@ -0,0 +1,65 @@
|
|||
<?php
|
||||
|
||||
/** @var \Illuminate\Database\Eloquent\Factory $factory */
|
||||
|
||||
use Faker\Generator as Faker;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Webkul\Core\Models\Channel;
|
||||
use Webkul\Customer\Models\Customer;
|
||||
use Webkul\Sales\Models\Order;
|
||||
|
||||
$factory->define(Order::class, function (Faker $faker) {
|
||||
$lastOrder = DB::table('orders')
|
||||
->orderBy('id', 'desc')
|
||||
->select('id')
|
||||
->first()
|
||||
->id ?? 0;
|
||||
|
||||
|
||||
$customer = factory(Customer::class)->create();
|
||||
|
||||
return [
|
||||
'increment_id' => $lastOrder + 1,
|
||||
'status' => 'pending',
|
||||
'channel_name' => 'Default',
|
||||
'is_guest' => 0,
|
||||
'customer_id' => $customer->id,
|
||||
'customer_email' => $customer->email,
|
||||
'customer_first_name' => $customer->first_name,
|
||||
'customer_last_name' => $customer->last_name,
|
||||
'is_gift' => 0,
|
||||
'total_item_count' => 1,
|
||||
'total_qty_ordered' => 1,
|
||||
'base_currency_code' => 'EUR',
|
||||
'channel_currency_code' => 'EUR',
|
||||
'order_currency_code' => 'EUR',
|
||||
'grand_total' => 0.0000,
|
||||
'base_grand_total' => 0.0000,
|
||||
'grand_total_invoiced' => 0.0000,
|
||||
'base_grand_total_invoiced' => 0.0000,
|
||||
'grand_total_refunded' => 0.0000,
|
||||
'base_grand_total_refunded' => 0.0000,
|
||||
'sub_total' => 0.0000,
|
||||
'base_sub_total' => 0.0000,
|
||||
'sub_total_invoiced' => 0.0000,
|
||||
'base_sub_total_invoiced' => 0.0000,
|
||||
'sub_total_refunded' => 0.0000,
|
||||
'base_sub_total_refunded' => 0.0000,
|
||||
'customer_type' => Customer::class,
|
||||
'channel_id' => 1,
|
||||
'channel_type' => Channel::class,
|
||||
'cart_id' => 0,
|
||||
];
|
||||
});
|
||||
|
||||
$factory->state(Order::class, 'pending', [
|
||||
'status' => 'pending',
|
||||
]);
|
||||
|
||||
$factory->state(Order::class, 'completed', [
|
||||
'status' => 'completed',
|
||||
]);
|
||||
|
||||
$factory->state(Order::class, 'closed', [
|
||||
'status' => 'closed',
|
||||
]);
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
<?php
|
||||
|
||||
/** @var \Illuminate\Database\Eloquent\Factory $factory */
|
||||
|
||||
use Faker\Generator as Faker;
|
||||
use Webkul\Sales\Models\Order;
|
||||
use Webkul\Sales\Models\Refund;
|
||||
|
||||
$factory->define(Refund::class, function (Faker $faker, array $attributes) {
|
||||
return [
|
||||
'order_id' => function () {
|
||||
return factory(Order::class)->create()->id;
|
||||
},
|
||||
];
|
||||
});
|
||||
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
<?php
|
||||
|
||||
/** @var \Illuminate\Database\Eloquent\Factory $factory */
|
||||
|
||||
use Faker\Generator as Faker;
|
||||
use Webkul\Inventory\Models\InventorySource;
|
||||
use Webkul\Sales\Models\OrderAddress;
|
||||
use Webkul\Sales\Models\Shipment;
|
||||
|
||||
$factory->define(Shipment::class, function (Faker $faker) {
|
||||
$address = factory(OrderAddress::class)->create();
|
||||
|
||||
return [
|
||||
'total_qty' => $faker->numberBetween(1, 20),
|
||||
'order_id' => $address->order_id,
|
||||
'order_address_id' => $address->id,
|
||||
'inventory_source_id' => function () {
|
||||
return factory(InventorySource::class)->create()->id;
|
||||
},
|
||||
];
|
||||
});
|
||||
|
||||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace Webkul\Sales\Providers;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factory as EloquentFactory;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class SalesServiceProvider extends ServiceProvider
|
||||
|
|
@ -15,11 +16,27 @@ class SalesServiceProvider extends ServiceProvider
|
|||
* Register services.
|
||||
*
|
||||
* @return void
|
||||
* @throws \Illuminate\Contracts\Container\BindingResolutionException
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
$this->registerEloquentFactoriesFrom(__DIR__ . '/../Database/Factories');
|
||||
|
||||
$this->mergeConfigFrom(
|
||||
dirname(__DIR__) . '/Config/system.php', 'core'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register factories.
|
||||
*
|
||||
* @param string $path
|
||||
*
|
||||
* @return void
|
||||
* @throws \Illuminate\Contracts\Container\BindingResolutionException
|
||||
*/
|
||||
protected function registerEloquentFactoriesFrom($path): void
|
||||
{
|
||||
$this->app->make(EloquentFactory::class)->load($path);
|
||||
}
|
||||
}
|
||||
|
|
@ -25,6 +25,6 @@
|
|||
"ez-plus": "^1.2.1",
|
||||
"vee-validate": "^2.2.15",
|
||||
"vue-flatpickr": "^2.3.0",
|
||||
"vue-slider-component": "^3.0.44"
|
||||
"vue-slider-component": "^2.7.5"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -39,9 +39,3 @@
|
|||
* (c) 2014-2019 Evan You
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* vue-class-component v7.0.1
|
||||
* (c) 2015-present Evan You
|
||||
* @license MIT
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
{
|
||||
"/js/shop.js": "/js/shop.js?id=8fc3af6f1d9024329021",
|
||||
"/js/shop.js": "/js/shop.js?id=d0a3f597b439d75f4a4e",
|
||||
"/css/shop.css": "/css/shop.css?id=617c680f279cb4a73734"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,29 @@
|
|||
<?php
|
||||
|
||||
|
||||
namespace Helper;
|
||||
|
||||
|
||||
use Codeception\Module;
|
||||
use Faker\Factory;
|
||||
use Faker\Generator;
|
||||
|
||||
class DataMocker extends Module
|
||||
{
|
||||
private static $faker;
|
||||
|
||||
/**
|
||||
* Get an instance of the faker
|
||||
*
|
||||
* @return Generator
|
||||
*
|
||||
* @author florianbosdorff
|
||||
*/
|
||||
public function fake(): Generator
|
||||
{
|
||||
if (self::$faker === null) {
|
||||
self::$faker = Factory::create();
|
||||
}
|
||||
return self::$faker;
|
||||
}
|
||||
}
|
||||
|
|
@ -10,6 +10,7 @@ modules:
|
|||
enabled:
|
||||
# add a framework module here
|
||||
- \Helper\Functional
|
||||
- \Helper\DataMocker
|
||||
- Asserts
|
||||
- Webkul\Core\Helpers\Laravel5Helper:
|
||||
environment_file: .env.testing
|
||||
|
|
|
|||
|
|
@ -0,0 +1,102 @@
|
|||
<?php
|
||||
|
||||
namespace Tests\Functional\Admin\Catalog;
|
||||
|
||||
|
||||
use FunctionalTester;
|
||||
use Webkul\Attribute\Models\Attribute;
|
||||
|
||||
class AttributeCest
|
||||
{
|
||||
public function testIndex(FunctionalTester $I): void
|
||||
{
|
||||
$attribute = $I->have(Attribute::class);
|
||||
|
||||
$I->loginAsAdmin();
|
||||
$I->amOnAdminRoute('admin.dashboard.index');
|
||||
$I->click(__('admin::app.layouts.catalog'), '//*[contains(@class, "navbar-left")]');
|
||||
$I->click(__('admin::app.layouts.attributes'), '//*[contains(@class, "aside-nav")]');
|
||||
|
||||
$I->seeCurrentRouteIs('admin.catalog.attributes.index');
|
||||
$I->see($attribute->id, '//script[@type="text/x-template"]');
|
||||
$I->see($attribute->admin_name, '//script[@type="text/x-template"]');
|
||||
}
|
||||
|
||||
public function testCreate(FunctionalTester $I): void
|
||||
{
|
||||
$I->loginAsAdmin();
|
||||
$I->amOnAdminRoute('admin.catalog.attributes.index');
|
||||
|
||||
$I->click('Add Attribute', '//*[contains(@class, "page-action")]');
|
||||
$I->seeCurrentRouteIs('admin.catalog.attributes.create');
|
||||
|
||||
$I->click('Save Attribute', '//*[contains(@class, "page-action")]');
|
||||
$I->seeFormHasErrors();
|
||||
|
||||
$testData = $this->fillForm($I);
|
||||
$I->click('Save Attribute', '//*[contains(@class, "page-action")]');
|
||||
|
||||
$I->dontSeeFormErrors();
|
||||
$I->seeCurrentRouteIs('admin.catalog.attributes.index');
|
||||
$I->seeRecord(Attribute::class, $testData);
|
||||
}
|
||||
|
||||
public function testEdit(FunctionalTester $I): void
|
||||
{
|
||||
$attribute = $I->have(Attribute::class, ['use_in_flat' => 0]);
|
||||
|
||||
$I->loginAsAdmin();
|
||||
$I->amOnAdminRoute('admin.catalog.attributes.index');
|
||||
|
||||
$route = route('admin.catalog.attributes.edit', ['id' => $attribute->id]);
|
||||
$I->seeInSource($route);
|
||||
$I->amOnPage($route);
|
||||
$I->seeCurrentRouteIs('admin.catalog.attributes.edit');
|
||||
|
||||
$I->fillField('admin_name', '');
|
||||
$I->click('Save Attribute', '//*[contains(@class, "page-action")]');
|
||||
$I->seeFormHasErrors();
|
||||
|
||||
$testData = $this->fillForm($I, true);
|
||||
$testData['id'] = $attribute->id;
|
||||
$I->click('Save Attribute', '//*[contains(@class, "page-action")]');
|
||||
|
||||
$I->dontSeeFormErrors();
|
||||
$I->seeRecord(Attribute::class, $testData);
|
||||
$I->seeCurrentRouteIs('admin.catalog.attributes.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FunctionalTester $I
|
||||
*
|
||||
* @param bool $skipType
|
||||
*
|
||||
* @return array with the test-data
|
||||
*/
|
||||
private function fillForm(FunctionalTester $I, bool $skipType = false): array
|
||||
{
|
||||
$testData = [
|
||||
'code' => $I->fake()->word,
|
||||
'type' => $I->fake()->randomElement([
|
||||
'text',
|
||||
'textarea',
|
||||
'price',
|
||||
'boolean',
|
||||
'select',
|
||||
'multiselect'
|
||||
]),
|
||||
'admin_name' => $I->fake()->word,
|
||||
];
|
||||
|
||||
$I->fillField('code', $testData['code']);
|
||||
$I->fillField('admin_name', $testData['admin_name']);
|
||||
|
||||
if ($skipType) {
|
||||
unset($testData['type']);
|
||||
} else {
|
||||
$I->selectOption('type', $testData['type']);
|
||||
}
|
||||
|
||||
return $testData;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,86 @@
|
|||
<?php
|
||||
|
||||
namespace Tests\Functional\Admin\Catalog;
|
||||
|
||||
|
||||
use FunctionalTester;
|
||||
use Webkul\Attribute\Models\AttributeFamily;
|
||||
|
||||
class AttributeFamilyCest
|
||||
{
|
||||
public function testIndex(FunctionalTester $I): void
|
||||
{
|
||||
$attributeFamily = $I->have(AttributeFamily::class);
|
||||
|
||||
$I->loginAsAdmin();
|
||||
$I->amOnAdminRoute('admin.dashboard.index');
|
||||
$I->click(__('admin::app.layouts.catalog'), '//*[contains(@class, "navbar-left")]');
|
||||
$I->click(__('admin::app.layouts.attribute-families'), '//*[contains(@class, "aside-nav")]');
|
||||
|
||||
$I->seeCurrentRouteIs('admin.catalog.families.index');
|
||||
$I->see($attributeFamily->id, '//script[@type="text/x-template"]');
|
||||
$I->see($attributeFamily->name, '//script[@type="text/x-template"]');
|
||||
}
|
||||
|
||||
public function testCreate(FunctionalTester $I): void
|
||||
{
|
||||
$I->loginAsAdmin();
|
||||
$I->amOnAdminRoute('admin.catalog.families.index');
|
||||
|
||||
$I->click(__('admin::app.catalog.families.add-family-btn-title'), '//*[contains(@class, "page-action")]');
|
||||
$I->seeCurrentRouteIs('admin.catalog.families.create');
|
||||
|
||||
$I->click(__('admin::app.catalog.families.save-btn-title'), '//*[contains(@class, "page-action")]');
|
||||
$I->seeFormHasErrors();
|
||||
|
||||
$testData = $this->fillForm($I);
|
||||
$I->click(__('admin::app.catalog.families.save-btn-title'), '//*[contains(@class, "page-action")]');
|
||||
|
||||
$I->dontSeeFormErrors();
|
||||
$I->seeCurrentRouteIs('admin.catalog.families.index');
|
||||
$I->seeRecord(AttributeFamily::class, $testData);
|
||||
}
|
||||
|
||||
public function testEdit(FunctionalTester $I): void
|
||||
{
|
||||
$attributeFamily = $I->have(AttributeFamily::class);
|
||||
|
||||
$I->loginAsAdmin();
|
||||
$I->amOnAdminRoute('admin.catalog.families.index');
|
||||
|
||||
$route = route('admin.catalog.families.edit', ['id' => $attributeFamily->id]);
|
||||
$I->seeInSource($route);
|
||||
$I->amOnPage($route);
|
||||
$I->seeCurrentRouteIs('admin.catalog.families.edit');
|
||||
|
||||
$I->fillField('name', '');
|
||||
$I->click(__('admin::app.catalog.families.save-btn-title'), '//*[contains(@class, "page-action")]');
|
||||
$I->seeFormHasErrors();
|
||||
|
||||
$testData = $this->fillForm($I);
|
||||
$testData['id'] = $attributeFamily->id;
|
||||
$I->click(__('admin::app.catalog.families.save-btn-title'), '//*[contains(@class, "page-action")]');
|
||||
|
||||
$I->dontSeeFormErrors();
|
||||
$I->seeRecord(AttributeFamily::class, $testData);
|
||||
$I->seeCurrentRouteIs('admin.catalog.families.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FunctionalTester $I
|
||||
*
|
||||
* @return array with the test-data
|
||||
*/
|
||||
private function fillForm(FunctionalTester $I): array
|
||||
{
|
||||
$testData = [
|
||||
'code' => $I->fake()->word,
|
||||
'name' => $I->fake()->word,
|
||||
];
|
||||
|
||||
$I->fillField('code', $testData['code']);
|
||||
$I->fillField('name', $testData['name']);
|
||||
|
||||
return $testData;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
<?php
|
||||
|
||||
namespace Tests\Functional\Admin\Catalog;
|
||||
|
||||
use FunctionalTester;
|
||||
use Webkul\Category\Models\Category;
|
||||
|
||||
class CategoryCest
|
||||
{
|
||||
public function testIndex(FunctionalTester $I): void
|
||||
{
|
||||
$category = $I->have(Category::class);
|
||||
|
||||
$I->loginAsAdmin();
|
||||
$I->amOnAdminRoute('admin.dashboard.index');
|
||||
$I->click(__('admin::app.layouts.catalog'), '//*[contains(@class, "navbar-left")]');
|
||||
$I->click(__('admin::app.layouts.categories'), '//*[contains(@class, "aside-nav")]');
|
||||
|
||||
$I->seeCurrentRouteIs('admin.catalog.categories.index');
|
||||
$I->see($category->id, '//script[@type="text/x-template"]');
|
||||
$I->see($category->name, '//script[@type="text/x-template"]');
|
||||
}
|
||||
}
|
||||
|
|
@ -1,7 +1,6 @@
|
|||
<?php
|
||||
|
||||
|
||||
namespace Tests\Functional\Product;
|
||||
namespace Tests\Functional\Webkul\Admin;
|
||||
|
||||
use FunctionalTester;
|
||||
use Faker\Factory;
|
||||
|
|
@ -24,7 +23,7 @@ class ProductCest
|
|||
/** @var AttributeOption $attributeBrandOption */
|
||||
private $attributeBrandOption;
|
||||
|
||||
public function _before(FunctionalTester $I)
|
||||
public function _before(FunctionalTester $I): void
|
||||
{
|
||||
$this->faker = Factory::create();
|
||||
|
||||
|
|
@ -55,22 +54,38 @@ class ProductCest
|
|||
|
||||
}
|
||||
|
||||
public function selectEmptyAttributeOptionOnProductCreation(FunctionalTester $I)
|
||||
public function testIndex(FunctionalTester $I): void
|
||||
{
|
||||
$product = $I->haveProduct([], ['simple']);
|
||||
|
||||
$I->loginAsAdmin();
|
||||
$I->amOnAdminRoute('admin.dashboard.index');
|
||||
$I->click(__('admin::app.layouts.catalog'), '//*[contains(@class, "navbar-left")]');
|
||||
$I->seeCurrentRouteIs('admin.catalog.products.index');
|
||||
$I->click(__('admin::app.layouts.products'), '//*[contains(@class, "aside-nav")]');
|
||||
|
||||
$I->seeCurrentRouteIs('admin.catalog.products.index');
|
||||
$I->see($product->id, '//script[@type="text/x-template"]');
|
||||
$I->see($product->name, '//script[@type="text/x-template"]');
|
||||
}
|
||||
|
||||
public function selectEmptyAttributeOptionOnProductCreation(FunctionalTester $I): void
|
||||
{
|
||||
$I->loginAsAdmin();
|
||||
$I->amOnAdminRoute('admin.catalog.products.index');
|
||||
|
||||
$I->amOnAdminRoute('admin.catalog.products.create');
|
||||
$I->see(__('admin::app.catalog.products.add-title'), 'h1');
|
||||
$I->click(__('admin::app.catalog.products.add-product-btn-title'), '//*[contains(@class, "page-action")]');
|
||||
$I->seeCurrentRouteIs('admin.catalog.products.create');
|
||||
|
||||
$I->selectOption('select#type', 'simple');
|
||||
$I->selectOption('type', 'simple');
|
||||
|
||||
$attributeFamily = $I->grabRecord(AttributeFamily::class, [
|
||||
'code' => 'default',
|
||||
]);
|
||||
|
||||
$I->selectOption('select#attribute_family_id', $attributeFamily->id);
|
||||
$I->selectOption('attribute_family_id', $attributeFamily->id);
|
||||
|
||||
$sku = $this->faker->uuid;
|
||||
$sku = $this->faker->randomNumber(3);
|
||||
|
||||
$I->fillField('sku', $sku);
|
||||
$I->click(__('admin::app.catalog.products.save-btn-title'));
|
||||
|
|
@ -89,8 +104,8 @@ class ProductCest
|
|||
$I->fillField('price', $this->faker->randomFloat(2));
|
||||
$I->fillField('weight', $this->faker->randomDigit);
|
||||
|
||||
$I->fillField('#short_description', $this->faker->paragraph(1, true));
|
||||
$I->fillField('#description', $this->faker->paragraph(5, true));
|
||||
$I->fillField('short_description', $this->faker->paragraph(1, true));
|
||||
$I->fillField('description', $this->faker->paragraph(5, true));
|
||||
|
||||
$I->click(__('admin::app.catalog.products.save-btn-title'));
|
||||
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
<?php
|
||||
|
||||
namespace Tests\Functional\Admin\Customer;
|
||||
|
||||
|
||||
use FunctionalTester;
|
||||
use Webkul\Customer\Models\Customer;
|
||||
|
||||
|
||||
class CustomerCest
|
||||
{
|
||||
public function testIndex(FunctionalTester $I): void
|
||||
{
|
||||
$customer = $I->have(Customer::class);
|
||||
|
||||
$I->loginAsAdmin();
|
||||
$I->amOnAdminRoute('admin.dashboard.index');
|
||||
$I->click(__('admin::app.layouts.customers'), '//*[contains(@class, "navbar-left")]');
|
||||
$I->seeCurrentRouteIs('admin.customer.index');
|
||||
$I->click(__('admin::app.layouts.customers'), '//*[contains(@class, "aside-nav")]');
|
||||
|
||||
$I->seeCurrentRouteIs('admin.customer.index');
|
||||
$I->see($customer->id, '//script[@type="text/x-template"]');
|
||||
$I->see($customer->name, '//script[@type="text/x-template"]');
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
<?php
|
||||
|
||||
namespace Tests\Functional\Admin\Customer;
|
||||
|
||||
|
||||
use FunctionalTester;
|
||||
use Webkul\Customer\Models\CustomerGroup;
|
||||
|
||||
|
||||
class GroupsCest
|
||||
{
|
||||
public function testIndex(FunctionalTester $I): void
|
||||
{
|
||||
$group = $I->have(CustomerGroup::class);
|
||||
|
||||
$I->loginAsAdmin();
|
||||
$I->amOnAdminRoute('admin.dashboard.index');
|
||||
$I->click(__('admin::app.layouts.customers'), '//*[contains(@class, "navbar-left")]');
|
||||
$I->click(__('admin::app.layouts.groups'), '//*[contains(@class, "aside-nav")]');
|
||||
|
||||
$I->seeCurrentRouteIs('admin.groups.index');
|
||||
$I->see($group->id, '//script[@type="text/x-template"]');
|
||||
$I->see($group->name, '//script[@type="text/x-template"]');
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
<?php
|
||||
|
||||
namespace Tests\Functional\Admin\Customer;
|
||||
|
||||
|
||||
use FunctionalTester;
|
||||
use Webkul\Core\Models\SubscribersList;
|
||||
|
||||
class NewsletterSubscriptionCest
|
||||
{
|
||||
public function testIndex(FunctionalTester $I): void
|
||||
{
|
||||
$subscriber = $I->have(SubscribersList::class);
|
||||
|
||||
$I->loginAsAdmin();
|
||||
$I->amOnAdminRoute('admin.dashboard.index');
|
||||
$I->click(__('admin::app.layouts.customers'), '//*[contains(@class, "navbar-left")]');
|
||||
$I->click(__('admin::app.layouts.newsletter-subscriptions'), '//*[contains(@class, "aside-nav")]');
|
||||
|
||||
$I->seeCurrentRouteIs('admin.customers.subscribers.index');
|
||||
$I->see($subscriber->id, '//script[@type="text/x-template"]');
|
||||
$I->see($subscriber->email, '//script[@type="text/x-template"]');
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
<?php
|
||||
|
||||
namespace Tests\Functional\Admin\Customer;
|
||||
|
||||
|
||||
use FunctionalTester;
|
||||
use Webkul\Product\Models\ProductReview;
|
||||
|
||||
|
||||
class ReviewCest
|
||||
{
|
||||
public function testIndex(FunctionalTester $I): void
|
||||
{
|
||||
$product = $I->haveProduct([], ['simple']);
|
||||
$review = $I->have(ProductReview::class, ['product_id' => $product->id]);
|
||||
|
||||
$I->loginAsAdmin();
|
||||
$I->amOnAdminRoute('admin.dashboard.index');
|
||||
$I->click(__('admin::app.layouts.customers'), '//*[contains(@class, "navbar-left")]');
|
||||
$I->click(__('admin::app.layouts.reviews'), '//*[contains(@class, "aside-nav")]');
|
||||
|
||||
$I->seeCurrentRouteIs('admin.customer.review.index');
|
||||
$I->see($review->id, '//script[@type="text/x-template"]');
|
||||
$I->see($review->title, '//script[@type="text/x-template"]');
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
|
||||
namespace Tests\Functional\Admin\Sales;
|
||||
|
||||
|
||||
use FunctionalTester;
|
||||
use Webkul\Sales\Models\Invoice;
|
||||
use Webkul\Sales\Models\OrderAddress;
|
||||
|
||||
|
||||
class InvoiceCest
|
||||
{
|
||||
public function testIndex(FunctionalTester $I): void
|
||||
{
|
||||
$orderAddress = $I->have(OrderAddress::class);
|
||||
$invoice = $I->have(Invoice::class,
|
||||
[
|
||||
'order_id' => $orderAddress->order_id,
|
||||
'order_address_id' => $orderAddress->id
|
||||
]);
|
||||
|
||||
$I->loginAsAdmin();
|
||||
$I->amOnAdminRoute('admin.dashboard.index');
|
||||
$I->click(__('admin::app.layouts.sales'), '//*[contains(@class, "navbar-left")]');
|
||||
$I->click(__('admin::app.layouts.invoices'), '//*[contains(@class, "aside-nav")]');
|
||||
|
||||
$I->seeCurrentRouteIs('admin.sales.invoices.index');
|
||||
$I->see($invoice->id, '//script[@type="text/x-template"]');
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
<?php
|
||||
|
||||
namespace Tests\Functional\Admin\Sales;
|
||||
|
||||
|
||||
use FunctionalTester;
|
||||
use Webkul\Sales\Models\Order;
|
||||
|
||||
|
||||
class OrderCest
|
||||
{
|
||||
public function testIndex(FunctionalTester $I): void
|
||||
{
|
||||
$order = $I->have(Order::class);
|
||||
|
||||
$I->loginAsAdmin();
|
||||
$I->amOnAdminRoute('admin.dashboard.index');
|
||||
$I->click(__('admin::app.layouts.sales'), '//*[contains(@class, "navbar-left")]');
|
||||
$I->seeCurrentRouteIs('admin.sales.orders.index');
|
||||
$I->click(__('admin::app.layouts.orders'), '//*[contains(@class, "aside-nav")]');
|
||||
|
||||
$I->seeCurrentRouteIs('admin.sales.orders.index');
|
||||
$I->see($order->id, '//script[@type="text/x-template"]');
|
||||
$I->see($order->sub_total, '//script[@type="text/x-template"]');
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
<?php
|
||||
|
||||
namespace Tests\Functional\Admin\Sales;
|
||||
|
||||
|
||||
use FunctionalTester;
|
||||
use Webkul\Sales\Models\Refund;
|
||||
|
||||
class RefundCest
|
||||
{
|
||||
public function testIndex(FunctionalTester $I): void
|
||||
{
|
||||
$refund = $I->have(Refund::class);
|
||||
|
||||
$I->loginAsAdmin();
|
||||
$I->amOnAdminRoute('admin.dashboard.index');
|
||||
$I->click(__('admin::app.layouts.sales'), '//*[contains(@class, "navbar-left")]');
|
||||
$I->click(__('admin::app.layouts.refunds'), '//*[contains(@class, "aside-nav")]');
|
||||
|
||||
$I->seeCurrentRouteIs('admin.sales.refunds.index');
|
||||
$I->see($refund->id, '//script[@type="text/x-template"]');
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
<?php
|
||||
|
||||
namespace Tests\Functional\Admin\Sales;
|
||||
|
||||
|
||||
use FunctionalTester;
|
||||
use Webkul\Sales\Models\Shipment;
|
||||
|
||||
class ShipmentsCest
|
||||
{
|
||||
public function testIndex(FunctionalTester $I): void
|
||||
{
|
||||
$shipment = $I->have(Shipment::class);
|
||||
|
||||
$I->loginAsAdmin();
|
||||
$I->amOnAdminRoute('admin.dashboard.index');
|
||||
$I->click(__('admin::app.layouts.sales'), '//*[contains(@class, "navbar-left")]');
|
||||
$I->click(__('admin::app.layouts.shipments'), '//*[contains(@class, "aside-nav")]');
|
||||
|
||||
$I->seeCurrentRouteIs('admin.sales.shipments.index');
|
||||
$I->see($shipment->id, '//script[@type="text/x-template"]');
|
||||
$I->see($shipment->total_qty, '//script[@type="text/x-template"]');
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue