ltsecurityinc安防产品在线商城代码
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
namespace Magento\Setup\Module\Dependency;
|
||||
|
||||
class CircularTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
/**
|
||||
* @var Circular
|
||||
*/
|
||||
protected $circular;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
$this->circular = new Circular();
|
||||
}
|
||||
|
||||
public function testBuildCircularDependencies()
|
||||
{
|
||||
$dependencies = [1 => [2], 2 => [3, 5], 3 => [1], 5 => [2]];
|
||||
$expectedCircularDependencies = [
|
||||
1 => [[1, 2, 3, 1]],
|
||||
2 => [[2, 3, 1, 2], [2, 5, 2]],
|
||||
3 => [[3, 1, 2, 3]],
|
||||
5 => [[5, 2, 5]],
|
||||
];
|
||||
$this->assertEquals($expectedCircularDependencies, $this->circular->buildCircularDependencies($dependencies));
|
||||
}
|
||||
}
|
||||
+56
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
namespace Magento\Setup\Module\Dependency\Parser\Composer;
|
||||
|
||||
class JsonTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $fixtureDir;
|
||||
|
||||
/**
|
||||
* @var Json
|
||||
*/
|
||||
protected $parser;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
$this->fixtureDir = realpath(__DIR__ . '/../../_files') . '/';
|
||||
|
||||
$this->parser = new Json();
|
||||
}
|
||||
|
||||
public function testParse()
|
||||
{
|
||||
$expected = [
|
||||
[
|
||||
'name' => 'magento/module-module1',
|
||||
'dependencies' => [
|
||||
['module' => 'magento/module-module2', 'type' => 'hard'],
|
||||
['module' => 'magento/module-backend', 'type' => 'soft'],
|
||||
],
|
||||
],
|
||||
[
|
||||
'name' => 'magento/module-module2',
|
||||
'dependencies' => [
|
||||
['module' => 'magento/module-module3', 'type' => 'hard'],
|
||||
]
|
||||
],
|
||||
];
|
||||
|
||||
$actual = $this->parser->parse(
|
||||
[
|
||||
'files_for_parse' => [
|
||||
$this->fixtureDir . 'composer1.json',
|
||||
$this->fixtureDir . 'composer2.json',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->assertEquals($expected, $actual);
|
||||
}
|
||||
}
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
namespace Magento\Setup\Module\Dependency\Parser\Config;
|
||||
|
||||
class XmlTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $fixtureDir;
|
||||
|
||||
/**
|
||||
* @var Xml
|
||||
*/
|
||||
protected $parser;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
$this->fixtureDir = realpath(__DIR__ . '/../../_files') . '/';
|
||||
|
||||
$this->parser = new Xml();
|
||||
}
|
||||
|
||||
public function testParse()
|
||||
{
|
||||
$expected = [
|
||||
'Magento\Module1',
|
||||
'Magento\Module2',
|
||||
];
|
||||
|
||||
$actual = $this->parser->parse(
|
||||
['files_for_parse' => [$this->fixtureDir . 'module1.xml', $this->fixtureDir . 'module2.xml']]
|
||||
);
|
||||
|
||||
$this->assertEquals($expected, $actual);
|
||||
}
|
||||
}
|
||||
+70
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
namespace Magento\Setup\Module\Dependency\Report;
|
||||
|
||||
use Magento\Setup\Module\Dependency\ServiceLocator;
|
||||
|
||||
class CircularTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $fixtureDir;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $sourceFilename;
|
||||
|
||||
/**
|
||||
* @var BuilderInterface
|
||||
*/
|
||||
protected $builder;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
$this->fixtureDir = realpath(__DIR__ . '/../_files') . '/';
|
||||
$this->sourceFilename = $this->fixtureDir . 'circular-dependencies.csv';
|
||||
|
||||
$this->builder = ServiceLocator::getCircularDependenciesReportBuilder();
|
||||
}
|
||||
|
||||
public function testBuild()
|
||||
{
|
||||
$this->builder->build(
|
||||
[
|
||||
'parse' => [
|
||||
'files_for_parse' => [$this->fixtureDir . 'composer4.json', $this->fixtureDir . 'composer5.json'],
|
||||
],
|
||||
'write' => ['report_filename' => $this->sourceFilename],
|
||||
]
|
||||
);
|
||||
|
||||
$this->assertFileEquals($this->fixtureDir . 'expected/circular-dependencies.csv', $this->sourceFilename);
|
||||
}
|
||||
|
||||
public function testBuildWithoutDependencies()
|
||||
{
|
||||
$this->builder->build(
|
||||
[
|
||||
'parse' => ['files_for_parse' => [$this->fixtureDir . 'composer3.json']],
|
||||
'write' => ['report_filename' => $this->sourceFilename],
|
||||
]
|
||||
);
|
||||
|
||||
$this->assertFileEquals(
|
||||
$this->fixtureDir . 'expected/without-circular-dependencies.csv',
|
||||
$this->sourceFilename
|
||||
);
|
||||
}
|
||||
|
||||
protected function tearDown(): void
|
||||
{
|
||||
if (file_exists($this->sourceFilename)) {
|
||||
unlink($this->sourceFilename);
|
||||
}
|
||||
}
|
||||
}
|
||||
+67
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
namespace Magento\Setup\Module\Dependency\Report;
|
||||
|
||||
use Magento\Setup\Module\Dependency\ServiceLocator;
|
||||
|
||||
class DependencyTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $fixtureDir;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $sourceFilename;
|
||||
|
||||
/**
|
||||
* @var BuilderInterface
|
||||
*/
|
||||
protected $builder;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
$this->fixtureDir = realpath(__DIR__ . '/../_files') . '/';
|
||||
$this->sourceFilename = $this->fixtureDir . 'dependencies.csv';
|
||||
|
||||
$this->builder = ServiceLocator::getDependenciesReportBuilder();
|
||||
}
|
||||
|
||||
public function testBuild()
|
||||
{
|
||||
$this->builder->build(
|
||||
[
|
||||
'parse' => [
|
||||
'files_for_parse' => [$this->fixtureDir . 'composer1.json', $this->fixtureDir . 'composer2.json'],
|
||||
],
|
||||
'write' => ['report_filename' => $this->sourceFilename],
|
||||
]
|
||||
);
|
||||
|
||||
$this->assertFileEquals($this->fixtureDir . 'expected/dependencies.csv', $this->sourceFilename);
|
||||
}
|
||||
|
||||
public function testBuildWithoutDependencies()
|
||||
{
|
||||
$this->builder->build(
|
||||
[
|
||||
'parse' => ['files_for_parse' => [$this->fixtureDir . 'composer3.json']],
|
||||
'write' => ['report_filename' => $this->sourceFilename],
|
||||
]
|
||||
);
|
||||
|
||||
$this->assertFileEquals($this->fixtureDir . 'expected/without-dependencies.csv', $this->sourceFilename);
|
||||
}
|
||||
|
||||
protected function tearDown(): void
|
||||
{
|
||||
if (file_exists($this->sourceFilename)) {
|
||||
unlink($this->sourceFilename);
|
||||
}
|
||||
}
|
||||
}
|
||||
+86
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
namespace Magento\Setup\Module\Dependency\Report;
|
||||
|
||||
use Magento\Setup\Module\Dependency\ServiceLocator;
|
||||
|
||||
class FrameworkTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $fixtureDir;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $fixtureDirModule;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $sourceFilename;
|
||||
|
||||
/**
|
||||
* @var BuilderInterface
|
||||
*/
|
||||
protected $builder;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
$this->fixtureDir = realpath(__DIR__ . '/../_files') . '/';
|
||||
$this->fixtureDirModule = $this->fixtureDir . 'code/Magento/FirstModule/';
|
||||
$this->sourceFilename = $this->fixtureDir . 'framework-dependencies.csv';
|
||||
|
||||
$this->builder = ServiceLocator::getFrameworkDependenciesReportBuilder();
|
||||
}
|
||||
|
||||
public function testBuild()
|
||||
{
|
||||
$this->builder->build(
|
||||
[
|
||||
'parse' => [
|
||||
'files_for_parse' => [
|
||||
$this->fixtureDirModule . 'Helper/Helper.php',
|
||||
$this->fixtureDirModule . 'Model/Model.php',
|
||||
$this->fixtureDirModule . 'view/frontend/template.phtml',
|
||||
],
|
||||
'config_files' => [$this->fixtureDirModule . 'etc/module.xml'],
|
||||
'declared_namespaces' => ['Magento'],
|
||||
],
|
||||
'write' => ['report_filename' => $this->sourceFilename],
|
||||
]
|
||||
);
|
||||
|
||||
$this->assertFileEquals($this->fixtureDir . 'expected/framework-dependencies.csv', $this->sourceFilename);
|
||||
}
|
||||
|
||||
public function testBuildWithoutDependencies()
|
||||
{
|
||||
$this->builder->build(
|
||||
[
|
||||
'parse' => [
|
||||
'files_for_parse' => [$this->fixtureDirModule . 'Model/WithoutDependencies.php'],
|
||||
'config_files' => [$this->fixtureDirModule . 'etc/module.xml'],
|
||||
'declared_namespaces' => ['Magento'],
|
||||
],
|
||||
'write' => ['report_filename' => $this->sourceFilename],
|
||||
]
|
||||
);
|
||||
|
||||
$this->assertFileEquals(
|
||||
$this->fixtureDir . 'expected/without-framework-dependencies.csv',
|
||||
$this->sourceFilename
|
||||
);
|
||||
}
|
||||
|
||||
protected function tearDown(): void
|
||||
{
|
||||
if (file_exists($this->sourceFilename)) {
|
||||
unlink($this->sourceFilename);
|
||||
}
|
||||
}
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
namespace Magento\FirstModule\Helper;
|
||||
|
||||
class Helper
|
||||
{
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function test()
|
||||
{
|
||||
new Magento\LibFirst();
|
||||
}
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
namespace Magento\FirstModule\Model;
|
||||
|
||||
use Magento\LibSecond;
|
||||
|
||||
class Model
|
||||
{
|
||||
/**
|
||||
* @use Magento\LibSecond()
|
||||
*/
|
||||
public function test()
|
||||
{
|
||||
new LibSecond();
|
||||
}
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
namespace Magento\FirstModule\Model;
|
||||
|
||||
class WithoutDependencies
|
||||
{
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function test()
|
||||
{
|
||||
}
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
-->
|
||||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
|
||||
<module name="Magento_FirstModule"/>
|
||||
</config>
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
?>
|
||||
<?php new Magento\Third();
|
||||
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"name": "magento/module-module1",
|
||||
"description": "N/A",
|
||||
"require": {
|
||||
"php": "~5.6.0|7.0.2|^7.0.6",
|
||||
"magento/module-module2": "0.1.0-alpha103"
|
||||
},
|
||||
"suggest": {
|
||||
"magento/module-backend": "0.1.0-alpha103"
|
||||
},
|
||||
"type": "magento2-module",
|
||||
"version": "0.1.0-alpha103"
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"name": "magento/module-module2",
|
||||
"description": "N/A",
|
||||
"require": {
|
||||
"php": "~5.6.0|7.0.2|^7.0.6",
|
||||
"magento/module-module3": "0.1.0-alpha103"
|
||||
},
|
||||
"type": "magento2-module",
|
||||
"version": "0.1.0-alpha103"
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"name": "magento/module-module1",
|
||||
"description": "N/A",
|
||||
"require": {
|
||||
"php": "~5.6.0|7.0.2|^7.0.6"
|
||||
},
|
||||
"type": "magento2-module",
|
||||
"version": "0.1.0-alpha103"
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"name": "magento/module-module1",
|
||||
"description": "N/A",
|
||||
"require": {
|
||||
"php": "~5.6.0|7.0.2|^7.0.6",
|
||||
"magento/module-module2": "0.1.0-alpha103"
|
||||
},
|
||||
"type": "magento2-module",
|
||||
"version": "0.1.0-alpha103"
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"name": "magento/module-module2",
|
||||
"description": "N/A",
|
||||
"require": {
|
||||
"php": "~5.6.0|7.0.2|^7.0.6",
|
||||
"magento/module-module1": "0.1.0-alpha103"
|
||||
},
|
||||
"type": "magento2-module",
|
||||
"version": "0.1.0-alpha103"
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
"Circular dependencies:","Total number of chains"
|
||||
,2
|
||||
|
||||
"Circular dependencies for each module:",
|
||||
magento/module-module1,1
|
||||
magento/module-module1->magento/module-module2->magento/module-module1
|
||||
|
||||
magento/module-module2,1
|
||||
magento/module-module2->magento/module-module1->magento/module-module2
|
||||
|
+10
@@ -0,0 +1,10 @@
|
||||
,All,Hard,Soft
|
||||
"Total number of dependencies",3,2,1
|
||||
|
||||
"Dependencies for each module:",All,Hard,Soft
|
||||
magento/module-module1,2,1,1
|
||||
" -- magento/module-module2",,1,0
|
||||
" -- magento/module-backend",,0,1
|
||||
|
||||
magento/module-module2,1,1,0
|
||||
" -- magento/module-module3",,1,0
|
||||
|
+8
@@ -0,0 +1,8 @@
|
||||
"Dependencies of framework:","Total number"
|
||||
,3
|
||||
|
||||
"Dependencies for each module:",
|
||||
Magento\FirstModule,3
|
||||
" -- Magento\LibFirst",1
|
||||
" -- Magento\LibSecond",2
|
||||
" -- Magento\Third",1
|
||||
|
+2
@@ -0,0 +1,2 @@
|
||||
"Circular dependencies:","Total number of chains"
|
||||
,0
|
||||
|
+2
@@ -0,0 +1,2 @@
|
||||
,All,Hard,Soft
|
||||
"Total number of dependencies",0,0,0
|
||||
|
+2
@@ -0,0 +1,2 @@
|
||||
"Dependencies of framework:","Total number"
|
||||
,0
|
||||
|
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
-->
|
||||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
|
||||
<module name="Magento_Module1">
|
||||
</module>
|
||||
</config>
|
||||
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
-->
|
||||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
|
||||
<module name="Magento_Module2">
|
||||
</module>
|
||||
</config>
|
||||
Reference in New Issue
Block a user