| 1 |
# scssphp |
| 2 |
### <http://leafo.github.io/scssphp> |
| 3 |
|
| 4 |
[](http://travis-ci.org/leafo/scssphp](http://travis-ci.org/leafo/scssphp](http://travis-ci.org/leafo/scssphp) |
| 5 |
[](https://packagist.org/packages/leafo/scssphp](https://packagist.org/packages/leafo/scssphp](https://packagist.org/packages/leafo/scssphp) |
| 6 |
|
| 7 |
`scssphp` is a compiler for SCSS written in PHP. |
| 8 |
|
| 9 |
Checkout the homepage, <http://leafo.github.io/scssphp>, for directions on how to use. |
| 10 |
|
| 11 |
## Running Tests |
| 12 |
|
| 13 |
`scssphp` uses [](https://github.com/sebastianbergmann/phpunitPHPUnit](https://github.com/sebastianbergmann/phpunit](https://github.com/sebastianbergmann/phpunit) for testing. |
| 14 |
|
| 15 |
Run the following command from the root directory to run every test: |
| 16 |
|
| 17 |
vendor/bin/phpunit tests |
| 18 |
|
| 19 |
There are several tests in the `tests/` directory: |
| 20 |
|
| 21 |
* `ApiTest.php` contains various unit tests that test the PHP interface. |
| 22 |
* `ExceptionTest.php` contains unit tests that test for exceptions thrown by the parser and compiler. |
| 23 |
* `FailingTest.php` contains tests reported in Github issues that demonstrate compatibility bugs. |
| 24 |
* `InputTest.php` compiles every `.scss` file in the `tests/inputs` directory |
| 25 |
then compares to the respective `.css` file in the `tests/outputs` directory. |
| 26 |
* `ScssTest.php` extracts (ruby) `scss` tests from the `tests/scss_test.rb` file. |
| 27 |
* `ServerTest.php` contains functional tests for the `Server` class. |
| 28 |
|
| 29 |
When changing any of the tests in `tests/inputs`, the tests will most likely |
| 30 |
fail because the output has changed. Once you verify that the output is correct |
| 31 |
you can run the following command to rebuild all the tests: |
| 32 |
|
| 33 |
BUILD=1 vendor/bin/phpunit tests |
| 34 |
|
| 35 |
This will compile all the tests, and save results into `tests/outputs`. |
| 36 |
|
| 37 |
To enable the `scss` compatibility tests: |
| 38 |
|
| 39 |
TEST_SCSS_COMPAT=1 vendor/bin/phpunit tests |
| 40 |
|
| 41 |
## Coding Standard |
| 42 |
|
| 43 |
`scssphp` source conforms to [](http://www.php-fig.org/psr/psr-2/PSR2](http://www.php-fig.org/psr/psr-2/](http://www.php-fig.org/psr/psr-2/). |
| 44 |
|
| 45 |
Run the following command from the root directory to check the code for "sniffs". |
| 46 |
|
| 47 |
vendor/bin/phpcs --standard=PSR2 bin src tests |
| 48 |
|