zoukankan      html  css  js  c++  java
  • laravel -- 单元测试

    <?php
    
    namespace TestsFeature;
    
    use TestsTestCase;
    
    /**
     * Class ExampleTest
     * 调用这里所有测试方法命令
     *          ./vendor/bin/phpunit  --filter 'Tests\Feature'
     *          ./vendor/bin/phpunit   --filter ExampleTest
     *
     * 查看方法:
     *           ./vendor/bin/phpunit  --help
     * @package TestsFeature
     */
    class ExampleTest extends TestCase
    {
        /**
         * A basic test example.
         *
         * @return void
         */
        public function testBasicTest()
        {
            $response = $this->get('/');
    
            $response->assertStatus(200);
        }
    
        /**
         *
         *  执行命令 ./vendor/bin/phpunit
         *           ./vendor/bin/phpunit  --group default
         *           ./vendor/bin/phpunit  --filter createRule
         *           ./vendor/bin/phpunit --filter 'Tests\Feature\ExampleTest::testCreateRule'
         * @return string|SymfonyComponentHttpFoundationStreamedResponse
         */
        public function testCreateRule()
        {
            exit('测试这个方法01');
        }
    
        /**
         *  执行这个方法
         * ./vendor/bin/phpunit  --filter fei
         * ./vendor/bin/phpunit --filter 'Tests\Feature\ExampleTest::testFei'
         */
        public function testFei()
        {
            $this->call('GET','api/User/login'); //调用对应的路由
            exit('eeeeeeeee');
        }
    }
  • 相关阅读:
    汇编/操作系统 索引帖
    极地网络
    河中跳房子游戏
    搬家大吉QAQQAQ
    【USACO3.1.1】Agri-Net最短网络
    浅谈二叉树
    Android面试经验汇总(二)
    Android面试经验汇总(一)
    Android 聊天室(二)
    Android 聊天室(一)
  • 原文地址:https://www.cnblogs.com/dafei4/p/13813034.html
Copyright © 2011-2022 走看看