title: How to use PHPUnit Skeleton Generator on classless php files?
body: <p>I heard about PHPUnit's ability to automatically generate base test files from this article: <a href="http://www.sitepoint.com/advanced-phpunit-testing-annotations-and-mocking/" rel="nofollow">http://www.sitepoint.com/advanced-phpunit-testing-annotations-and-mocking/</a></p>
  
  <p>(Note that PHPUnit-skelgen is now a sepparate utility from the rest of the PHPUnit project, it's source can be found here: <a href="https://github.com/sebastianbergmann/phpunit-skeleton-generator" rel="nofollow">https://github.com/sebastianbergmann/phpunit-skeleton-generator</a>)</p>
  
  <p>If I use phpunit-skelgen on the following piece of code:</p>
  
  <pre><code>&lt;?php
  
  class TestClass {
  
      /**
       * @assert (1, 2) == 3
       */
      function add($a, $b) {
          return $a + $b;
      }
  }
  ?&gt;
  </code></pre>
  
  <p>By running <code>phpunit-skelgen generate-test TestClass</code>, I am greeted with the following test method (along with the usual phpunit boilerplate):</p>
  
  <pre><code>/**
   * Generated from @assert (1, 2) == 3.
   *
   * @covers TestClass::add
   */
  public function testAdd()
  {
      $this-&gt;assertEquals(
          3,
          $this-&gt;object-&gt;add(1, 2)
      );
  }
  </code></pre>
  
  <p>My question is, is it possible to have phpunit-skelgen create tests for a php file without classes in it? For example, I have a rather large file with several global action functions I would like to have phpunit-skelgen create tests for, but I do not see a way to do so without wrapping my existing code in a class.</p>
  
  <hr>
  
  <p>Edit: This is the output if I try to run phpunit-skelgen on a php file with functions but no class:</p>
  
  <pre><code>theguy@workpc ~/Projects/PHPUnitSamples $ phpunit-skelgen generate-test noClass
  phpunit-skelgen 2.0.1 by Sebastian Bergmann.
  
  
  
  
  [RuntimeException]                                                                    
  Could not find class "noClass" in "/home/perry/Projects/PHPUnitSamples/noClass.php".  
  
  
  
  generate-test [--bootstrap="..."] class [class-source] [test-class] [test-source]
  </code></pre>
  
  <hr>
  
  <p>Does anyone have any suggestions?</p>
  
  <p>Also, I noticed that recent documentation for phpunit-skelgen is extremely scarce. Does anyone know of some good tutorials or manuals or something that have been written since phpunit-skelgen was moved into it's own separate project?</p>