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 驱动学习 环境部署中的问题
  • ¥15 【急】在线问答CNC雕刻机的电子电路与编程
  • ¥60 在mc68335芯片上移植ucos ii 的成功工程文件
  • ¥15 笔记本外接显示器正常,但是笔记本屏幕黑屏
  • ¥15 Python pandas
  • ¥15 蓝牙硬件,可以用哪几种方法控制手机点击和滑动
  • ¥15 生物医学数据分析。基础课程就v经常唱课程舅成牛逼
  • ¥15 云环境云开发云函数对接微信商户中的分账功能
  • ¥15 空间转录组CRAD遇到问题
  • ¥20 materialstudio计算氢键脚本问题