laravel架构

时间:2023-03-09 17:41:23
laravel架构

1、Laravel 5.1 中的异常处理器和HTTP异常处理实例教程

http://laravelacademy.org/post/1867.html

2、laravel 集成sentry,sentry通知用slack

https://api.slack.com/incoming-webhooks#getting-started

3、Laravel 模型事件入门

https://laravel-china.org/topics/9037/an-introduction-to-the-laravel-model-event

4、repository

https://packagist.org/packages/prettus/l5-repository

https://www.jianshu.com/p/dcaaf801c294

5、服务

三分钟学会扩展laravel服务    https://blog.csdn.net/i6448038/article/details/51050024

创建 Service Provider 测试实例   http://laravelacademy.org/post/796.html

深入探討Service Provider   https://oomusou.io/laravel/laravel-service-provider/

6、单元测试

http://laravelacademy.org/post/2100.html

1、概述及配置

Laravel 中集成了PHPUnit进行单元测试,实际上,使用PHPUnit进行单元测试在Laravel中是开箱即用的,测试的配置文件为根目录下的phpunit.xml,该配置文件为我们做好了所有配置工作:

<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
bootstrap="bootstrap/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false">
<testsuites>
<testsuite name="Application Test Suite">
<directory>./tests/</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory suffix=".php">app/</directory>
</whitelist>
</filter>
<php>
<env name="APP_ENV" value="testing"/>
<env name="CACHE_DRIVER" value="array"/>
<env name="SESSION_DRIVER" value="array"/>
<env name="QUEUE_DRIVER" value="sync"/>
</php>
</phpunit>

testsuites中定义了测试文件存放路径为根目录下的tests目录。

filter中定义了需要进行单元测试的PHP文件存放位置。

php中配置了测试环境的环境变量,默认APP_ENV为testing,缓存驱动被设置为array,Session驱动被设置为array,队列驱动被设置为sync