mirror of
http://124.126.16.154:8888/singularity/HyperfDevelopmentKit.git
synced 2026-01-15 00:35:08 +08:00
init: 初始化项目
This commit is contained in:
8
.gitignore
vendored
Normal file
8
.gitignore
vendored
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
# IDEs
|
||||||
|
.idea/
|
||||||
|
.vscode/
|
||||||
|
|
||||||
|
# Build Dists
|
||||||
|
vendor/
|
||||||
|
composer.phar
|
||||||
|
.phpunit.result.cache
|
||||||
56
Dockerfile
Normal file
56
Dockerfile
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
# Default Dockerfile
|
||||||
|
#
|
||||||
|
# @link https://www.hyperf.io
|
||||||
|
# @document https://hyperf.wiki
|
||||||
|
# @contact group@hyperf.io
|
||||||
|
# @license https://github.com/hyperf/hyperf/blob/master/LICENSE
|
||||||
|
|
||||||
|
FROM hyperf/hyperf:8.0-alpine-v3.12-swoole
|
||||||
|
|
||||||
|
##
|
||||||
|
# ---------- env settings ----------
|
||||||
|
##
|
||||||
|
# --build-arg timezone=Asia/Shanghai
|
||||||
|
ARG timezone
|
||||||
|
ARG app_env
|
||||||
|
ARG app_status
|
||||||
|
ARG site
|
||||||
|
|
||||||
|
ENV TIMEZONE=${timezone:-"Asia/Shanghai"} \
|
||||||
|
APP_ENV=${app_env:-"devel"} \
|
||||||
|
SCAN_CACHEABLE=(true) \
|
||||||
|
SITE=${site:-"cn"}
|
||||||
|
|
||||||
|
# update
|
||||||
|
RUN set -ex \
|
||||||
|
# show php version and extensions
|
||||||
|
&& php -v \
|
||||||
|
&& php -m \
|
||||||
|
&& php --ri swoole \
|
||||||
|
# ---------- some config ----------
|
||||||
|
&& cd /etc/php8 \
|
||||||
|
# - config PHP
|
||||||
|
&& { \
|
||||||
|
echo "upload_max_filesize=128M"; \
|
||||||
|
echo "post_max_size=128M"; \
|
||||||
|
echo "memory_limit=1G"; \
|
||||||
|
echo "date.timezone=${TIMEZONE}"; \
|
||||||
|
echo "phar.readonly=Off"; \
|
||||||
|
} | tee conf.d/99_overrides.ini \
|
||||||
|
# - config timezone
|
||||||
|
&& ln -sf /usr/share/zoneinfo/${TIMEZONE} /etc/localtime \
|
||||||
|
&& echo "${TIMEZONE}" > /etc/timezone \
|
||||||
|
# ---------- clear works ----------
|
||||||
|
&& rm -rf /var/cache/apk/* /tmp/* /usr/share/man \
|
||||||
|
&& echo -e "\033[42;37m Build Completed :).\033[0m\n"
|
||||||
|
|
||||||
|
WORKDIR /srv/www
|
||||||
|
|
||||||
|
COPY composer.lock .
|
||||||
|
COPY composer.json .
|
||||||
|
RUN composer install --no-dev -o
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
EXPOSE 9501
|
||||||
|
|
||||||
|
ENTRYPOINT ["php", "/srv/www/bin/hyperf.php", "start"]
|
||||||
22
LICENCE.md
Normal file
22
LICENCE.md
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2020 Elliot J. Reed
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
|
|
||||||
69
README.md
Normal file
69
README.md
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
# PHP Package Boilerplate / Example Project
|
||||||
|
|
||||||
|
This repository shows a basic setup for a PHP package or application in PHP.
|
||||||
|
|
||||||
|
## PHP Versions
|
||||||
|
|
||||||
|
This version will work on PHP version 8.0 and above.
|
||||||
|
|
||||||
|
For a version which is compatible with PHP 7.4 and above select the 7.4 Git tag ([github.com/elliotjreed/php-package-boilerplate/tree/7.4](https://github.com/elliotjreed/php-package-boilerplate/tree/7.4)).
|
||||||
|
|
||||||
|
## Getting Started
|
||||||
|
|
||||||
|
PHP 8.0 or above and Composer is expected to be installed on our system.
|
||||||
|
|
||||||
|
### Installing Composer
|
||||||
|
|
||||||
|
For instructions on how to install Composer visit [getcomposer.org](https://getcomposer.org/download/).
|
||||||
|
|
||||||
|
### Installing
|
||||||
|
|
||||||
|
After cloning this repository, change into the newly created directory and run
|
||||||
|
|
||||||
|
```bash
|
||||||
|
composer install
|
||||||
|
```
|
||||||
|
|
||||||
|
or if you have installed Composer locally in your current directory
|
||||||
|
|
||||||
|
```bash
|
||||||
|
php composer.phar install
|
||||||
|
```
|
||||||
|
|
||||||
|
This will install all dependencies needed for the project.
|
||||||
|
|
||||||
|
## Running the Tests
|
||||||
|
|
||||||
|
All tests can be run by executing
|
||||||
|
|
||||||
|
```bash
|
||||||
|
vendor/bin/phpunit
|
||||||
|
```
|
||||||
|
|
||||||
|
`phpunit` will automatically find all tests inside the `test` directory and run them based on the configuration in the `phpunit.xml` file.
|
||||||
|
|
||||||
|
### Testing Approach
|
||||||
|
|
||||||
|
The test for the class `Greeting` verifies that the return value of the `sayHello` method returns the string "Hello {name}", where {name} is the value passed through to the constructor.
|
||||||
|
|
||||||
|
## Running the Application
|
||||||
|
|
||||||
|
PHP has an in-built server for local development. This can be started by executing
|
||||||
|
|
||||||
|
```
|
||||||
|
php -S localhost:8000 -t public
|
||||||
|
```
|
||||||
|
|
||||||
|
Then open your browser at `http://localhost:8000/example.php`
|
||||||
|
|
||||||
|
You should see the text "Hello Ada Lovelace" on your screen.
|
||||||
|
|
||||||
|
## Built With
|
||||||
|
|
||||||
|
- [PHP](https://secure.php.net/)
|
||||||
|
- [Composer](https://getcomposer.org/)
|
||||||
|
- [PHPUnit](https://phpunit.de/)
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
This project is licensed under the MIT License - see the [LICENCE.md](LICENCE.md) file for details.
|
||||||
46
composer.json
Normal file
46
composer.json
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
{
|
||||||
|
"name": "singularity/hyperf-development-kit",
|
||||||
|
"description": "The General Development Kit for Hyperf framework",
|
||||||
|
"type": "library",
|
||||||
|
"require": {
|
||||||
|
"php": "~8.0",
|
||||||
|
"hyperf/framework": "~2.2.4",
|
||||||
|
"composer/composer": "~2.0.14"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"phpunit/phpunit": "^9.5"
|
||||||
|
},
|
||||||
|
"config": {
|
||||||
|
"optimize-autoloader": true,
|
||||||
|
"sort-packages": true
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Singularity\\HyperfDevelopmentKit\\": "src/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload-dev": {
|
||||||
|
"psr-4": {
|
||||||
|
"Tests\\Example\\": "tests/Example/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "李东云",
|
||||||
|
"email": "dongyun.li@luxcreo.ai"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"minimum-stability": "stable",
|
||||||
|
"scripts": {
|
||||||
|
"post-root-package-install": [],
|
||||||
|
"test": "vendor/bin/phpunit --prepend test/bootstrap.php -c phpunit.xml --colors=always",
|
||||||
|
"cs-fix": "php-cs-fixer fix $1",
|
||||||
|
"analyse": "phpstan analyse --memory-limit 300M -l 0 -c phpstan.neon ./app ./config"
|
||||||
|
},
|
||||||
|
"repositories": {
|
||||||
|
"packagist": {
|
||||||
|
"type": "composer",
|
||||||
|
"url": "https://mirrors.aliyun.com/composer"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
4632
composer.lock
generated
Normal file
4632
composer.lock
generated
Normal file
File diff suppressed because it is too large
Load Diff
128
guide.md
Normal file
128
guide.md
Normal file
@@ -0,0 +1,128 @@
|
|||||||
|
# PHP Package boilerplate project explanation
|
||||||
|
|
||||||
|
PHP is a general-purpose server-side scripting language primarily used in web development. Originally created by Rasmus Lerdorf in 1994, it is now by The PHP Development Team.
|
||||||
|
|
||||||
|
PHP originally stood for "Personal Home Page", but now stands for "PHP: Hypertext Preprocessor".
|
||||||
|
|
||||||
|
## Further Material
|
||||||
|
|
||||||
|
- Homepage: [php.net](https://secure.php.net/)
|
||||||
|
- Documentation: [php.net/docs.php](https://secure.php.net/docs.php)
|
||||||
|
- PHP: The Right Way: [phptherightway.com](http://www.phptherightway.com/)
|
||||||
|
- Interactive PHP Tutorial: [learn-php.org](http://www.learn-php.org/)
|
||||||
|
|
||||||
|
## Topics, Tools and Terms
|
||||||
|
|
||||||
|
PHP packages were traditionally installed via PEAR (PHP Extension and Application Repository), but more recently the standard package and dependency management tool is Composer.
|
||||||
|
|
||||||
|
Composer lets us run install commands to add packages to our system, for example `composer require phpunit` would add the unit testing framework PHPUnit to our system.
|
||||||
|
|
||||||
|
For instructions on how to install Composer visit [getcomposer.org](https://getcomposer.org/download/).
|
||||||
|
|
||||||
|
### Dependency Management
|
||||||
|
|
||||||
|
Managing dependencies manually is time-consuming, fortunately Composer can automate this.
|
||||||
|
|
||||||
|
We can list our dependencies in a `composer.json` file and run `composer install` to bring these into our project.
|
||||||
|
|
||||||
|
An example `composer.json` file looks like this:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"name": "example-project",
|
||||||
|
"require": {
|
||||||
|
"twig/twig": "^3.0"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"phpunit/phpunit": "^8.4"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
The "require" block tells Composer that the Twig templating package is required for production use and can install Twig with a version of 3.x.x (ie. up to, but not including, version 4).
|
||||||
|
|
||||||
|
The "require-dev" block tells Composer that PHPUnit is required in development, but not in production.
|
||||||
|
|
||||||
|
Dependencies can be added to `composer.json` by
|
||||||
|
|
||||||
|
```bash
|
||||||
|
composer require author/package-name
|
||||||
|
```
|
||||||
|
|
||||||
|
Development dependencies can be added by
|
||||||
|
|
||||||
|
```bash
|
||||||
|
composer require author/package-name --dev
|
||||||
|
```
|
||||||
|
|
||||||
|
Dependencies can be updated to their latest maximum version by running
|
||||||
|
|
||||||
|
```bash
|
||||||
|
composer update
|
||||||
|
```
|
||||||
|
|
||||||
|
Composer will also generate a `composer.lock` file on each `composer update` and the initial `composer install`. This is not meant to be edited directly, it tells Composer to use specific versions of packages - particularly useful when hyhou want your development dependencies to match what you will push to production.
|
||||||
|
|
||||||
|
### Testing Tools
|
||||||
|
|
||||||
|
There are a number of testing tools available for PHP. The most popular one is [PHPUnit](https://phpunit.de/). PHPUnit follows the classic xUnit approach.
|
||||||
|
|
||||||
|
[Behat](http://behat.org/en/latest/) is the most popular behaviour-driven development (BDD) testing framework.
|
||||||
|
|
||||||
|
[Codeception](http://codeception.com/) is a framework combining BDD, unit testing, and integration testing, and is cross-compatible with PHPUnit.
|
||||||
|
|
||||||
|
In this guide we will be using PHPUnit as the testing framework.
|
||||||
|
|
||||||
|
## Directory Structure
|
||||||
|
|
||||||
|
A typical directory structure for a PHP project consists of a `src` directory that contains all source files and a `tests` directory that includes all tests. For web applications the publicly accessible files (eg. `index.php`) would reside in a `public` directory which would then be your webservers document root.
|
||||||
|
|
||||||
|
Another common convention is having a `bin` directory that may contain executable files to start your application.
|
||||||
|
|
||||||
|
- src/
|
||||||
|
- test/
|
||||||
|
- public/
|
||||||
|
- composer.json
|
||||||
|
- composer.lock
|
||||||
|
|
||||||
|
### Naming Conventions
|
||||||
|
|
||||||
|
Directory names are in lower case. Class and interface files should be in upper case and match the class or interface names.
|
||||||
|
Configuration, routes, and publicly accessible files should be in lower case.
|
||||||
|
|
||||||
|
For example the class `Example` should be contained in file `Example.php`, the publicly accessible route to the application should be `index.php`.
|
||||||
|
|
||||||
|
Tests match their production code file names with a `Test` suffix, e.g. tests for code in `src/Example.php` should be written in `test/ExampleTest.php`.
|
||||||
|
|
||||||
|
## Example Project
|
||||||
|
|
||||||
|
The main application consists of basically two files:
|
||||||
|
|
||||||
|
- `public/example.php` is the main executable that instantiates and runs:
|
||||||
|
- `src/Example/Greeting.php` contains the main application.
|
||||||
|
|
||||||
|
### Running the Tests
|
||||||
|
|
||||||
|
All tests can be run by executing
|
||||||
|
|
||||||
|
```bash
|
||||||
|
vendor/phpunit/phpunit/phpunit
|
||||||
|
```
|
||||||
|
|
||||||
|
`phpunit` will automatically find all tests inside the `test` directory and run them based on the configuration in the `phpunit.xml` file.
|
||||||
|
|
||||||
|
#### Testing Approach
|
||||||
|
|
||||||
|
The test for the class `Greeting` verifies that the return value of the `sayHello` method returns the string "Hello {name}", where {name} is the value passed through to the constructor.
|
||||||
|
|
||||||
|
### Running the Application
|
||||||
|
|
||||||
|
PHP has an in-built server for local development. To run this change into the directory `public` and run
|
||||||
|
|
||||||
|
```bash
|
||||||
|
php -S localhost:8000
|
||||||
|
```
|
||||||
|
|
||||||
|
Then open your browser at `http://localhost:8000/example.php`
|
||||||
|
|
||||||
|
You should see the text "Hello Ada Lovelace" being printed.
|
||||||
9
phpunit.xml
Normal file
9
phpunit.xml
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="vendor/autoload.php" backupGlobals="false" colors="true" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.5/phpunit.xsd">
|
||||||
|
<coverage/>
|
||||||
|
<testsuites>
|
||||||
|
<testsuite name="Example">
|
||||||
|
<directory>./tests/Example/</directory>
|
||||||
|
</testsuite>
|
||||||
|
</testsuites>
|
||||||
|
</phpunit>
|
||||||
7
scripts/container/git-config.sh
Normal file
7
scripts/container/git-config.sh
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
export name
|
||||||
|
export email
|
||||||
|
|
||||||
|
git config --global user.email "${email}"
|
||||||
|
git config --global user.name "${name}"
|
||||||
3
scripts/container/list_dir.sh
Normal file
3
scripts/container/list_dir.sh
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
alias ll='ls $LS_OPTIONS -l --color=auto' 2>/dev/null
|
||||||
|
alias l.='ls $LS_OPTIONS -d .* --color=auto' 2>/dev/null
|
||||||
|
alias ls='ls $LS_OPTIONS --color=auto' 2>/dev/null
|
||||||
6
scripts/container/ssh-key-permission.sh
Normal file
6
scripts/container/ssh-key-permission.sh
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
chmod -R 700 ~/.ssh
|
||||||
|
#chmod 600 ~/.ssh/authorized_keys
|
||||||
|
|
||||||
|
#chown -R git:git ~/.ssh
|
||||||
8
scripts/unix/build-image.sh
Executable file
8
scripts/unix/build-image.sh
Executable file
@@ -0,0 +1,8 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
docker login harbor.luxcreo.cn -u php -p fTr6oVvqqdzVlYgnZhRPPAP54u7SmqGA
|
||||||
|
|
||||||
|
image_name=harbor.luxcreo.cn/php/composer-template
|
||||||
|
docker build --tag $image_name .
|
||||||
|
|
||||||
|
#docker push $image_name
|
||||||
|
#docker push ${image_name}-dev
|
||||||
8
scripts/unix/docker-env.sh
Executable file
8
scripts/unix/docker-env.sh
Executable file
@@ -0,0 +1,8 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
docker run \
|
||||||
|
-ti --rm --name "hyperf-development-kit" \
|
||||||
|
-w "/srv/www" \
|
||||||
|
-v "$(pwd)":/srv/www \
|
||||||
|
-v ~/.ssh:/root/.ssh \
|
||||||
|
hyperf/hyperf:8.0-alpine-v3.12-swoole /bin/ash
|
||||||
4
scripts/win/build-images.bat
Normal file
4
scripts/win/build-images.bat
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
docker login harbor.luxcreo.cn -u admin -p Mao+690629
|
||||||
|
|
||||||
|
set image_name=composer-template
|
||||||
|
docker build --force-rm=true --target cd --tag %image_name% --target dev --tag %image_name%-dev .
|
||||||
11
scripts/win/docker-env.bat
Normal file
11
scripts/win/docker-env.bat
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
@echo off
|
||||||
|
|
||||||
|
for /F %%i in ('chdir') do ( set current_dir=%%i)
|
||||||
|
|
||||||
|
docker run ^
|
||||||
|
-ti --rm --name "composer-template" ^
|
||||||
|
-v "%current_dir%":"/srv/www" ^
|
||||||
|
-v "%USERPROFILE%\.ssh":"/root/.ssh" ^
|
||||||
|
-p 8866:80 ^
|
||||||
|
--env-file=.env ^
|
||||||
|
hyperf/hyperf:8.0-alpine-v3.12-swoole /bin/ash
|
||||||
2
scripts/win/prettier.bat
Normal file
2
scripts/win/prettier.bat
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
if "%*"=="" (echo <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>/<2F>ļ<EFBFBD><C4BC><EFBFBD> & exit 1) else .\vendor\bin\phpcs.bat %* || echo. & echo <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>⣬<EFBFBD><E2A3AC><EFBFBD><EFBFBD><EFBFBD>Զ<EFBFBD><D4B6><EFBFBD>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ctrl-c ȡ<><C8A1> & pause &.\vendor\bin\phpcbf %* && echo <20><>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
::@echo off ::<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϸ<EFBFBD><CFB7>ھ<EFBFBD><DABE>ᱨ<D7BB><E1B1A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֪<EFBFBD><D6AA>ɶԭ<C9B6><D4AD>
|
||||||
6
scripts/win/readme.md
Normal file
6
scripts/win/readme.md
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
# Windows 系统常用脚本
|
||||||
|
|
||||||
|
## 格式化
|
||||||
|
```bat
|
||||||
|
.\scripts\win\prettier.bat .\application\alpha.php
|
||||||
|
```
|
||||||
20
src/Example/Greeting.php
Normal file
20
src/Example/Greeting.php
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Singularity\HyperfDevelopmentKit\Example;
|
||||||
|
|
||||||
|
class Greeting
|
||||||
|
{
|
||||||
|
private $name = 'Stranger';
|
||||||
|
|
||||||
|
public function __construct( $name = 'Stranger')
|
||||||
|
{
|
||||||
|
$this->name = $name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function sayHello(): string
|
||||||
|
{
|
||||||
|
return 'Hello ' . $this->name;
|
||||||
|
}
|
||||||
|
}
|
||||||
18
tests/Example/GreetingTest.php
Normal file
18
tests/Example/GreetingTest.php
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Tests\Example;
|
||||||
|
|
||||||
|
use PHPUnit\Framework\TestCase;
|
||||||
|
use Singularity\HyperfDevelopmentKit\Example\Greeting;
|
||||||
|
|
||||||
|
class GreetingTest extends TestCase
|
||||||
|
{
|
||||||
|
public function testItGreetsUser(): void
|
||||||
|
{
|
||||||
|
$greeting = new Greeting('Rasmus Lerdorf');
|
||||||
|
|
||||||
|
$this->assertSame('Hello Rasmus Lerdorf', $greeting->sayHello());
|
||||||
|
}
|
||||||
|
}
|
||||||
16
tests/bootstrap.php
Normal file
16
tests/bootstrap.php
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
/**
|
||||||
|
* This file is part of Hyperf.
|
||||||
|
*
|
||||||
|
* @link https://www.hyperf.io
|
||||||
|
* @document https://hyperf.wiki
|
||||||
|
* @contact group@hyperf.io
|
||||||
|
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
|
||||||
|
*/
|
||||||
|
ini_set('display_errors', 'on');
|
||||||
|
ini_set('display_startup_errors', 'on');
|
||||||
|
|
||||||
|
error_reporting(E_ALL);
|
||||||
|
date_default_timezone_set('Asia/Shanghai');
|
||||||
Reference in New Issue
Block a user