8.10. Make A Test Suite

./script/solar make-tests ClassName [--only]

This command creates a suite of test cases for a given class name, and each of the classes in its subdirectories. Each test class will contain a set of hook methods for pre-test setup, post-test teardown, and so on. The test class will also contain one test method for each public method on the subject class.

For example, take the following series of class directories:

Vendor.php          # Vendor
    Foo.php         # Vendor_Foo
        Baz.php     # Vendor_Foo_Baz
        Dib.php     # Vendor_Foo_Dib
    Bar.php         # Vendor_Bar
        Zim.php     # Vendor_Bar_Zim
        Gir.php     # Vendor_Bar_Gir

If you issue make-tests Vendor_Foo_Baz, the command will create one Test_Vendor_Foo_Baz test class file.

However, if you issue make-tests Vendor_Foo, then the command will create three test class files: Test_Vendor_Foo, Test_Vendor_Foo_Baz, and Test_Vendor_Foo_Dib.

Finally, if you want to create a test for just one class without descending into its subdirectories, pass the --only option.