3
votes
php - Netbeans 8.0.1 with PHPUnit and Skeleton generator - Stack Overflow
Asked
Viewed 1k times
3

I have installed Netbeans together with PHPUnit and phpunit-skeleton-generator from homebrew. I can generate a testfile from the terminal by running phpunit-skelgen --test -- "UrlDecoder" classes/UrlDecoder.class.php, however Netbeans refuses when I right-click the file, select tools > Create tests. This is the error I get: Netbeands Error

And this is the output from the log:

"/usr/local/opt/php55/bin/php" "/usr/local/bin/phpunit-skelgen" "--ansi" "generate-test" "--bootstrap=/Users/paulp/Sites/fortv/tests/bootstrap.php" "UrlDecoder" "/Users/paulp/Sites/fortv/classes/UrlDecoder.class.php" "UrlDecoderTest" "/Users/paulp/Sites/fortv/tests/classes/UrlDecoder.classTest.php"

/usr/bin/env php -d allow_url_fopen=On -d detect_unicode=Off /usr/local/Cellar/phpunit-skeleton-generator/1.2.1/libexec/phpunit-skelgen-1.2.1.phar $*
Done.

Most tutorials and help I find online are for Netbeans 7.x, which makes things harder. I have tried with different bootstrap files and xml files, but no different result. The Output tells me nothing, and nothing happens. I have googled this for a bit, but found nothing similar to my problem.

The only thing I notice is the --ansi part, which the skeleton generator documentation doesn't seem to offer.

My question: How can I get Netbeans to generate tests using phpunit skeleton generator?

1
  • I think you need to specify the class with namespace. I am not using Netbeans, but the PHPUnit generator normally needs namespaces with the classes, if you are using them. Sep 11 2014 at 18:42
0
  • I've installed phpunit on my Mac manually following the manual's instructions (it is pretty easy so you don't need brew script).
  • Then in Netbeans (8.0.2) preferences (PHP->Frameworks&Tools->PHPUnit) I have set up paths to sctipts.
  • In the project properties phpunit should be switched on (I know that's obvious). And then Tools->Create tests works just out-of-the-box. :)

However my first experience with phpunit installation was not so funny. So I can understand that users could be frustrated at the begining. It was because I have expected full automation through plugin installation and such things which not worked. That's why I describe full process (phpunit+netbeans on osx)on my [blog][1].

    Your Answer

    By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

    Not the answer you're looking for? Browse other questions tagged or ask your own question.

     
    1
    I think you need to specify the class with namespace. I am not using Netbeans, but the PHPUnit generator normally needs namespaces with the classes, if you are using them. - Steven Scott

    1 Answers

    0
    votes
    • I've installed phpunit on my Mac manually following the manual's instructions (it is pretty easy so you don't need brew script).
    • Then in Netbeans (8.0.2) preferences (PHP->Frameworks&Tools->PHPUnit) I have set up paths to sctipts.
    • In the project properties phpunit should be switched on (I know that's obvious). And then Tools->Create tests works just out-of-the-box. :)

    However my first experience with phpunit installation was not so funny. So I can understand that users could be frustrated at the begining. It was because I have expected full automation through plugin installation and such things which not worked. That's why I describe full process (phpunit+netbeans on osx)on my [blog][1].