Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
XigenDominic committed May 5, 2020
2 parents 048e83f + ddde9eb commit 5218081
Show file tree
Hide file tree
Showing 17 changed files with 149 additions and 29 deletions.
9 changes: 0 additions & 9 deletions .github/workflows/php.yml

This file was deleted.

9 changes: 9 additions & 0 deletions .github/workflows/phpcompatibility.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: PHPCompatibility
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: 7.0-7.3
run: docker run --rm -v $PWD:/code domw/phpcompatibility phpcs --standard=PHPCompatibility --runtime-set testVersion 7.0-7.3 --colors --warning-severity=0 --report=full,summary --extensions=php,phtml ./
9 changes: 9 additions & 0 deletions .github/workflows/phpcs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: phpcs
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Magento 2 Ruleset
run: docker run --rm -v $PWD:/code domw/phpcs phpcs --colors --standard=Magento2 --report=full,summary,gitblame --extensions=php,phtml ./
14 changes: 14 additions & 0 deletions .github/workflows/phpstan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: PHPStan
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: MilesChou/composer-action@master
env:
COMPOSER_AUTH: ${{secrets.COMPOSER_AUTH}}
with:
args: install --prefer-dist --no-dev --ignore-platform-reqs
- name: PHPStan
run: docker run --rm -v $PWD:/code domw/phpstan phpstan analyze ./
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/vendor
/.idea
/.vscode
14 changes: 12 additions & 2 deletions Console/Command/Category.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,16 @@ class Category extends Command
*/
protected $categoryHelper;

/**
* @var InputInterface
*/
protected $input;

/**
* @var OutputInterface
*/
protected $output;

/**
* Category constructor.
* @param \Psr\Log\LoggerInterface $logger
Expand Down Expand Up @@ -81,11 +91,11 @@ protected function execute(
(string) __('You are about to generate fake category data. Are you sure? [y/N]'),
false
);

if (!$helper->ask($this->input, $this->output, $question) && $this->input->isInteractive()) {
return Cli::RETURN_FAILURE;
}

$this->output->writeln('[' . $this->dateTime->gmtDate() . '] Start');

$progress = new ProgressBar($this->output, $limit);
Expand Down
11 changes: 10 additions & 1 deletion Console/Command/Customer.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,15 @@ class Customer extends Command
*/
protected $customerHelper;

/**
* @var InputInterface
*/
protected $input;

/**
* @var OutputInterface
*/
protected $output;
/**
* Customer constructor.
* @param \Psr\Log\LoggerInterface $logger
Expand Down Expand Up @@ -81,7 +90,7 @@ protected function execute(
(string) __('You are about to generate fake customer data. Are you sure? [y/N]'),
false
);

if (!$helper->ask($this->input, $this->output, $question) && $this->input->isInteractive()) {
return Cli::RETURN_FAILURE;
}
Expand Down
14 changes: 12 additions & 2 deletions Console/Command/Order.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,16 @@ class Order extends Command
*/
protected $orderHelper;

/**
* @var InputInterface
*/
protected $input;

/**
* @var OutputInterface
*/
protected $output;

/**
* Order constructor.
* @param \Psr\Log\LoggerInterface $logger
Expand Down Expand Up @@ -81,11 +91,11 @@ protected function execute(
(string) __('You are about to generate fake order data. Are you sure? [y/N]'),
false
);

if (!$helper->ask($this->input, $this->output, $question) && $this->input->isInteractive()) {
return Cli::RETURN_FAILURE;
}

$this->output->writeln('[' . $this->dateTime->gmtDate() . '] Start');

$progress = new ProgressBar($this->output, $limit);
Expand Down
23 changes: 18 additions & 5 deletions Console/Command/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace Xigen\Faker\Console\Command;

use Magento\Catalog\Model\Product\Type;
use Magento\Framework\App\Area;
use Magento\Framework\Console\Cli;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Helper\ProgressBar;
Expand All @@ -10,8 +12,6 @@
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Question\ConfirmationQuestion;
use Magento\Catalog\Model\Product\Type;
use Magento\Framework\App\Area;

/**
* Product Console
Expand Down Expand Up @@ -44,6 +44,16 @@ class Product extends Command
*/
protected $productHelper;

/**
* @var InputInterface
*/
protected $input;

/**
* @var OutputInterface
*/
protected $output;

/**
* Product constructor.
* @param \Psr\Log\LoggerInterface $logger
Expand Down Expand Up @@ -82,16 +92,19 @@ protected function execute(

if ($generate) {
$helper = $this->getHelper('question');

$question = new ConfirmationQuestion(
(string) __('You are about to generate fake product data%1. Are you sure? [y/N]', (($image) ? ' with images' : '')),
(string) __(
'You are about to generate fake product data%1. Are you sure? [y/N]',
(($image) ? ' with images' : '')
),
false
);

if (!$helper->ask($this->input, $this->output, $question) && $this->input->isInteractive()) {
return Cli::RETURN_FAILURE;
}

$this->output->writeln('[' . $this->dateTime->gmtDate() . '] Start');

$progress = new ProgressBar($this->output, $limit);
Expand Down
14 changes: 12 additions & 2 deletions Console/Command/Review.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,16 @@ class Review extends Command
*/
protected $reviewHelper;

/**
* @var InputInterface
*/
protected $input;

/**
* @var OutputInterface
*/
protected $output;

/**
* Review constructor.
* @param \Psr\Log\LoggerInterface $logger
Expand Down Expand Up @@ -77,12 +87,12 @@ protected function execute(

if ($generate) {
$helper = $this->getHelper('question');

$question = new ConfirmationQuestion(
(string) __('You are about to generate fake review data. Are you sure? [y/N]'),
false
);

if (!$helper->ask($this->input, $this->output, $question) && $this->input->isInteractive()) {
return Cli::RETURN_FAILURE;
}
Expand Down
15 changes: 15 additions & 0 deletions Helper/Order.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,21 @@ class Order extends AbstractHelper
*/
protected $stockItem;

/**
* @var \Magento\Framework\App\ObjectManager
*/
protected $_objectManager;

/**
* @var Magento\Quote\Api\CartManagementInterface
*/
protected $cartManagementInterface;

/**
* @var Magento\Sales\Model\Service\InvoiceService
*/
protected $invoiceService;

/**
* Order constructor.
* @param \Magento\Framework\App\Helper\Context $context
Expand Down
3 changes: 1 addition & 2 deletions Helper/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace Xigen\Faker\Helper;

use Magento\Framework\App\Helper\AbstractHelper;
use Magento\Catalog\Model\Product\Type;

/**
* Product helper
Expand Down Expand Up @@ -317,7 +316,7 @@ public function getRandomProduct($limit = 1, $inStockOnly = false, $simpleOnly =
if ($simpleOnly) {
$collection->addAttributeToFilter('type_id', ['eq' => \Magento\Catalog\Model\Product\Type::TYPE_SIMPLE]);
}

if ($inStockOnly) {
$this->stockFilter->addInStockFilterToCollection($collection);
}
Expand Down
10 changes: 10 additions & 0 deletions Helper/Review.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,16 @@ class Review extends AbstractHelper
*/
protected $reviewFactory;

/**
* @var \Xigen\Faker\Helper\Customer
*/
protected $customerHelper;

/**
* @var \Xigen\Faker\Helper\Product
*/
protected $productHelper;

/**
* @var \Magento\Store\Model\StoreManagerInterface
*/
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Faker extension #

![phpcs](https://github.com/DominicWatts/Faker/workflows/phpcs/badge.svg)

![PHPCompatibility](https://github.com/DominicWatts/Faker/workflows/PHPCompatibility/badge.svg)

![PHPStan](https://github.com/DominicWatts/Faker/workflows/PHPStan/badge.svg)

Magento 2 extension to generate fake data.

This extension uses `fzaninotto/faker`
Expand Down
11 changes: 6 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"description": "Console based fake data generator - just generate what you need",
"type": "magento2-module",
"license": "proprietary",
"version": "1.1.10",
"version": "1.1.11",
"authors": [
{
"name": "Dominic Xigen",
Expand All @@ -20,10 +20,11 @@
"require": {
"fzaninotto/faker": "*",
"magento/framework": "*",
"php": "~5.6.0||~7.0.0||~7.1.0||~7.2.0||~7.3.0"
},
"require-dev": {
"fzaninotto/faker": "*"
"php": "~5.6.0||~7.0.0||~7.1.0||~7.2.0||~7.3.0",
"symfony/console": "*",
"magento/module-catalog": "*",
"magento/module-quote": "*",
"magento/module-shipping": "*"
},
"autoload": {
"psr-4": {
Expand Down
2 changes: 1 addition & 1 deletion etc/module.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" ?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Xigen_Faker" setup_version="1.1.10"/>
<module name="Xigen_Faker" setup_version="1.1.11"/>
</config>
11 changes: 11 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
parameters:
level: 0
autoload_directories:
- Console
- Helper
excludes_analyse:
- 'vendor'
ignoreErrors:
- '#invalid typehint#'
- '#unknown class#'
reportUnmatchedIgnoredErrors: false

0 comments on commit 5218081

Please sign in to comment.