This commit is contained in:
cloud 2022-04-15 04:37:19 +08:00
parent 31d3ff4aa4
commit ffe19cd023
13 changed files with 30 additions and 17 deletions

View File

@ -1 +1,2 @@
{"version":1,"defects":{"demo\\Creational\\FactoryMethod\\tests\\FactoryMethodTest::testCanCreateStdoutLogging":4,"demo\\Creational\\FactoryMethod\\tests\\FactoryMethodTest::testCanCreateFileLogging":4,"demo\\Creational\\FactoryMethod\\tests\\StdoutLoggerTest::testCanCreateStdoutLogging":4,"demo\\Creational\\FactoryMethod\\tests\\StdoutLoggerTest::testCanCreateFileLogging":4,"demo\\Creational\\FactoryMethod\\tests\\StdoutLoggerTest::testLog":4,"demo\\Creational\\Singleton\\Tests\\SingletonTest::testUniqueness":4,"demo\\Structural\\DependencyInjection\\Tests\\DependencyInjectionTest::testDependencyInjection":4},"times":{"demo\\Creational\\FactoryMethod\\tests\\FactoryMethodTest::testCanCreateStdoutLogging":0.007,"demo\\Creational\\FactoryMethod\\tests\\FactoryMethodTest::testCanCreateFileLogging":0,"StackTest::testPushAndPop":0.004,"demo\\Creational\\FactoryMethod\\tests\\StdoutLoggerTest::testCanCreateStdoutLogging":0.005,"demo\\Creational\\FactoryMethod\\tests\\StdoutLoggerTest::testCanCreateFileLogging":0,"demo\\Creational\\FactoryMethod\\tests\\StdoutLoggerTest::testLog":0.004,"demo\\Creational\\Singleton\\Tests\\SingletonTest::testUniqueness":0.005,"demo\\Structural\\DependencyInjection\\Tests\\DependencyInjectionTest::testDependencyInjection":0.007}} {"version":1,"defects":{"demo\\Creational\\FactoryMethod\\tests\\FactoryMethodTest::testCanCreateStdoutLogging":4,"demo\\Creational\\FactoryMethod\\tests\\FactoryMethodTest::testCanCreateFileLogging":4,"demo\\Creational\\FactoryMethod\\tests\\StdoutLoggerTest::testCanCreateStdoutLogging":4,"demo\\Creational\\FactoryMethod\\tests\\StdoutLoggerTest::testCanCreateFileLogging":4,"demo\\Creational\\FactoryMethod\\tests\\StdoutLoggerTest::testLog":4,"demo\\Creational\\Singleton\\Tests\\SingletonTest::testUniqueness":4,"demo\\Structural\\DependencyInjection\\Tests\\DependencyInjectionTest::testDependencyInjection":4},"times":{"demo\\Creational\\FactoryMethod\\tests\\FactoryMethodTest::testCanCreateStdoutLogging":0.007,"demo\\Creational\\FactoryMethod\\tests\\FactoryMethodTest::testCanCreateFileLogging":0,"StackTest::testPushAndPop":0.004,"demo\\Creational\\FactoryMethod\\tests\\StdoutLoggerTest::testCanCreateStdoutLogging":0.005,"demo\\Creational\\FactoryMethod\\tests\\StdoutLoggerTest::testCanCreateFileLogging":0,"demo\\Creational\\FactoryMethod\\tests\\StdoutLoggerTest::testLog":0.004,"demo\\Creational\\Singleton\\Tests\\SingletonTest::testUniqueness":0.005,"demo\\Structural\\DependencyInjection\\Tests\\DependencyInjectionTest::testDependencyInjection":0.007}}

View File

@ -1,6 +1,9 @@
<?php <?php
declare(strict_types = 1); declare(strict_types = 1);
/**
* phpunit 实例
*/
class StackTest extends \PHPUnit\Framework\TestCase class StackTest extends \PHPUnit\Framework\TestCase
{ {
public function testPushAndPop() : void public function testPushAndPop() : void
@ -8,11 +11,11 @@ class StackTest extends \PHPUnit\Framework\TestCase
$stack = []; $stack = [];
$this->assertSame(0, count($stack)); $this->assertSame(0, count($stack));
$stack[] = 'foo'; $stack[] = 'fooq';
$this->assertSame('foo', $stack[count($stack)-1]); $this->assertSame('fooq', $stack[ count($stack) - 1 ]);
$this->assertSame(1, count($stack)); $this->assertSame(1, count($stack));
$this->assertSame('foo', array_pop($stack)); $this->assertSame('fooq', array_pop($stack));
$this->assertSame(0, count($stack)); $this->assertSame(0, count($stack));
} }
} }

View File

@ -2,6 +2,9 @@
namespace bin; namespace bin;
/**
* demo入口父类
*/
abstract class Design abstract class Design
{ {
/** /**

View File

@ -2,6 +2,9 @@
namespace bin; namespace bin;
/**
* 接口
*/
interface DesignInterface interface DesignInterface
{ {

View File

@ -23,3 +23,4 @@
"vimeo/psalm": "5.x-dev" "vimeo/psalm": "5.x-dev"
} }
} }

1
composer.lock generated
View File

@ -4338,3 +4338,4 @@
"platform-dev": [], "platform-dev": [],
"plugin-api-version": "2.2.0" "plugin-api-version": "2.2.0"
} }

View File

@ -1 +1 @@
# 行为型 # 行为型模式

View File

@ -1 +1 @@
# 创建型 # 创建型模式

View File

@ -1 +1 @@
# 更多其他类型 # 更多其他类型模式

View File

@ -1 +1 @@
# 结构型 # 结构型模式

View File

@ -1,11 +1,11 @@
<?php <?php
// 根目录
const ROOTDIR = __DIR__; const ROOTDIR = __DIR__;
// composer 自动依赖注入文件
require ROOTDIR . '/vendor/autoload.php'; require ROOTDIR . '/vendor/autoload.php';
// 自动实现的自动依赖注入文件
require ROOTDIR . '/bin/Psr4Autoload.php'; require ROOTDIR . '/bin/Psr4Autoload.php';
// 注册命名空间
(new \bin\Psr4Autoload)->register(); (new \bin\Psr4Autoload)->register();
// 首页默认内容
(new \bin\Base); (new \bin\Base);

View File

@ -13,3 +13,4 @@
</ignoreFiles> </ignoreFiles>
</projectFiles> </projectFiles>
<plugins><pluginClass class="Psalm\PhpUnitPlugin\Plugin"/></plugins></psalm> <plugins><pluginClass class="Psalm\PhpUnitPlugin\Plugin"/></plugins></psalm>