Testing PHP API code

After writing PHP code to modify pattern instances, test the code to check that it works correctly.

Before you begin

Before you test your PHP code, you must build the pattern plug-ins; see Building pattern plug-ins.

About this task

You can check that your PHP scripts work correctly by creating an instance of your user-defined pattern. When you test your user-defined pattern, a new workspace is opened in which to create the instance of your pattern. If you want to change your PHP code and retest it, you are not required to open a new workspace after each change. If you make any other changes to the pattern authoring project, you must rebuild the pattern plug-ins and launch a new workspace.

Procedure

To test your user-defined pattern, see Testing a user-defined pattern. A new workspace is opened in which you generate an instance of your user-defined pattern. After the pattern instance is generated, check that your PHP code has worked correctly. For example, if you write PHP code to remove files from a pattern instance project, check that the files are deleted.

What to do next

You can either change your PHP code and retest it or you can package and distribute your user-defined pattern:
  • To change and retest your PHP code, repeat the following steps until all your changes are complete. You can keep the test workspace open and continue to change your code and generate pattern instances without closing and relaunching the test workspace after each change:
    1. Edit the PHP code file in your main workspace and save the file.
    2. In the test workspace, generate a new instance of your user-defined pattern and check the results.
  • To package and distribute your user-defined pattern, see Packaging and distributing pattern plug-ins.