dongyan1625 2013-09-04 08:44
浏览 73
已采纳

phpunit-skelgen:没有生成测试文件

I try to use phpunit-skelgen

In the doc, it is written

When you are using the skeleton generator to generate code based on a class that is declared in a namespace you have to provide the qualified name of the class as well as the path to the source file it is declared in.

For instance, for a class Calculator that is declared in the project namespace you need to invoke the skeleton generator like this:

phpunit-skelgen --test -- "project\Calculator" Calculator.php PHPUnit Skeleton Generator 1.0.0 by Sebastian Bergmann.

Wrote skeleton for "project\CalculatorTest" to "/home/sb/CalculatorTest.php".

I'm working with symfony 2 My class is like this :

<?php
// src/Acme/SecurityBundle/Security/User/MyUserProvider.php

namespace Acme\SecurityBundle\Security\User;

use Symfony\Component\Security\Core\User\UserProviderInterface;
use Symfony\Component\Security\Core\User\UserInterface;
use Symfony\Component\Security\Core\Exception\UsernameNotFoundException;
use Symfony\Component\Security\Core\Exception\UnsupportedUserException;

use Acme\SecurityBundle\Security\User\MyUser;

class MyUserProvider implements UserProviderInterface
{
    // public functions ...
}

I've tried to run, from my application base directory

phpunit-skelgen --test -- "Acme\SecurityBundle\Security\User\MyUserProvider" "Absolute\Path\to\src\Acme\SecurityBundle\Security\User\MyUserProvider.php"
phpunit-skelgen --test -- "Acme\SecurityBundle\Security\User\MyUserProvider" Absolute\Path\to\src\Acme\SecurityBundle\Security\User\MyUserProvider.php
phpunit-skelgen --test -- Acme\SecurityBundle\Security\User\MyUserProvider Absolute\Path\to\src\Acme\SecurityBundle\Security\User\MyUserProvider.php

even

phpunit-skelgen --test -- "Acme\SecurityBundle\Security\User\MyUserProvider" MyUserProvider.php

and

phpunit-skelgen --test -- MyUserProvider MyUserProvider.php

from Absolute\Path\to\src\Acme\SecurityBundle\Security\User\

phpunit-skelgen --test -- "Acme\SecurityBundle\Security\User\MyUserProvider" MyUserProvider.php

The output is always

PHPUnit Skeleton Generator 1.2.1 by Sebastian Bergmann.

Nothing more. Does anyone has an idea ?

  • 写回答

1条回答 默认 最新

  • dongsan6889 2013-09-05 13:53
    关注

    I simply forgot the bootstrap

    phpunit-skelgen --bootstrap app\bootstrap.php.cache --test -- "Acme\SecurityBundle\Security\User\MyUserProvider" "E:\path\to\app\src\Acme\SecurityBundle\Security\User\MyUserProvider.php"
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 C++ 头文件/宏冲突问题解决
  • ¥15 用comsol模拟大气湍流通过底部加热(温度不同)的腔体
  • ¥50 安卓adb backup备份子用户应用数据失败
  • ¥20 有人能用聚类分析帮我分析一下文本内容嘛
  • ¥15 请问Lammps做复合材料拉伸模拟,应力应变曲线问题
  • ¥30 python代码,帮调试
  • ¥15 #MATLAB仿真#车辆换道路径规划
  • ¥15 java 操作 elasticsearch 8.1 实现 索引的重建
  • ¥15 数据可视化Python
  • ¥15 要给毕业设计添加扫码登录的功能!!有偿