Skip to content

Latest commit

 

History

History
55 lines (48 loc) · 1.98 KB

COVERAGE.md

File metadata and controls

55 lines (48 loc) · 1.98 KB

Code Coverage Guidelines

Automatic Visual Code Coverage (using Sublime Text)

If you use SublimeText as your editor, you can automatically visualize code coverage using the Sublime Code Coverage package and the Sublime Build on Save package.

  1. Install both Sublime packages.

  2. Go to Preferences > Settings - User and add the following settings:

    "binary_file_patterns":
    [
          "vendor/*"
    ]
  3. Create a file in the root of the L4withSentry project called l4withsentry.sublime-project and put the following in it, replacing /usr/local/php5/bin with your php path.

{
    "folders":
    [
        {
            "path": "./"
        }
    ],
    "settings":
    {
        "filename_filter": "\\.(php|.html.blade)$",
        "build_on_save": 1
    },
    "build_systems":
    [
        {
            "name": "PHPUNIT",
            "path": "/usr/local/php5/bin",
            "cmd": [
                "$project_path/vendor/bin/phpunit",
                "--coverage-clover=$project_path/build/logs/clover.xml",
                "--configuration=$project_path/phpunit.xml"
            ]
        }
    ]
}
  1. Restart Sublime Text
  2. Reopen L4withSentry using these steps:
  3. Go to Project > Open Project...
  4. Select the l4withsentry.sublime-project that you created above.
  5. Manually build the project
  6. Tools > Build System, make sure PHPUNIT is selected
  7. Click Tools > Build to run phpunit against the project and generate initial coverage files.
  8. You should now be able to open app/controllers/UserController.php and visually see the what code is covered by tests and what code is not.

Note: If a file is not referenced at all in a test, then it will not have any visual indicators in it. To start seeing visual indicators, write a test that covers some part of this file.