Skip to content

Commit 236c34b

Browse files
committed
Refactored category creation script
1 parent 99b944e commit 236c34b

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

scripts/abstract.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
use Magento\Framework\App\AreaList as AreaList;
1111
use Magento\Framework\App\State as State;
1212

13-
class AbstractApp implements AppInterface
13+
abstract class AbstractApp implements AppInterface
1414
{
1515
public function __construct(
1616
\Magento\Framework\ObjectManagerInterface $objectManager,
@@ -36,9 +36,12 @@ public function __construct(
3636

3737
public function launch()
3838
{
39+
$this->run();
3940
return $this->_response;
4041
}
4142

43+
abstract public function run();
44+
4245
public function catchException(\Magento\Framework\App\Bootstrap $bootstrap, \Exception $exception)
4346
{
4447
return false;

scripts/create-categories.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66
class CreateCategoriesApp extends AbstractApp
77
{
88

9-
public function launch()
9+
public function run()
1010
{
1111
$this->_objectManager->get('Magento\Framework\Registry')
1212
->register('isSecureArea', true);
1313

14-
for ($i=0; $i<200; ++$i) {
14+
for ($i=0; $i<2500; ++$i) {
1515
$newCategoryName = 'Performance Category ' .$i;
1616

1717
/** @var Magento\Catalog\Model\Category\Interceptor $newCategory */
@@ -35,8 +35,6 @@ public function launch()
3535
echo "Deleting\t" . $newCategoryName . PHP_EOL;
3636
}
3737
}
38-
39-
return parent::launch();
4038
}
4139
}
4240

0 commit comments

Comments
 (0)