currentMenu |
---|
getting-started |
The recommended way to install Kahlan is with Composer as a development dependency of your project.
composer require --dev kahlan/kahlan
Alternatively, you may manually add "kahlan/kahlan": "~4.0"
to the require-dev
dependencies within your composer.json
.
The Kahlan package is installed with a vendor library and its binary accessible through vendor/bin/kahlan
by default. However, you can configure its location like all other composer vendor binaries.
Once Kahlan is installed, you can run your tests (referred to as specs) with:
./vendor/bin/kahlan
For a full list of the options, see the CLI Options.
The recommended directory structure is to add a spec
directory at the top level of your project. You may then place your Spec files within this directory. Spec files should have a .spec.php
or Spec.php
suffix. The spec
directory should mirror the structure of your source code directory.
An example directory structure would be:
├── spec # The directory containing your specs
│ └── ClassA.spec.php
│ └── subdir
│ └── ClassB.spec.php
├── src # The directory containing your source code
│ └── ClassA.php
│ └── subdir
│ └── ClassB.php
├── composer.json
└── README.md
For basic, you can clone https://github.com/sitrunlab/learn-kahlan to get started.