vendor/topthink/framework/tests/AppTest.php

(开头部分) 1KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

<?php

namespace think\tests;

use Mockery as m;
use org\bovigo\vfs\vfsStream;
use org\bovigo\vfs\vfsStreamDirectory;
use PHPUnit\Framework\TestCase;
use stdClass;
use think\App;
use think\Env;
use think\Event;
use think\event\AppInit;
use think\exception\ClassNotFoundException;
use think\Service;

class SomeService extends Service
{
    public $bind = [
        'some' => 'class',
    ];

    public function register()
    {

    }

    public function boot()
    {

    }
}

/**
 * @property array initializers
 */
class AppTest extends TestCase
{
    /** @var App */
    protected $app;

    protected function setUp()
    {
        $this->app = new App();
    }

    protected function tearDown(): void
    {
        m::close();
    }

    public function testService()
    {
        $this->app->register(stdClass::class);

        $this->assertInstanceOf(stdClass::class, $this->app->getService(stdClass::class));

        $service = m::mock(SomeService::class);

        $service->shouldReceive('register')->once();

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。