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 乌班图ip地址配置及远程SSH
  • ¥15 怎么让点阵屏显示静态爱心,用keiluVision5写出让点阵屏显示静态爱心的代码,越快越好
  • ¥15 PSPICE制作一个加法器
  • ¥15 javaweb项目无法正常跳转
  • ¥15 VMBox虚拟机无法访问
  • ¥15 skd显示找不到头文件
  • ¥15 机器视觉中图片中长度与真实长度的关系
  • ¥15 fastreport table 怎么只让每页的最下面和最顶部有横线
  • ¥15 java 的protected权限 ,问题在注释里
  • ¥15 这个是哪里有问题啊?