Skip to content

Commit

Permalink
Merge pull request #24 from StydeNet/feature/code_snippets
Browse files Browse the repository at this point in the history
Allow developers to record code snippets and the result of calling them
  • Loading branch information
sileence authored Oct 22, 2020
2 parents 755f022 + ccd6ce1 commit 217b9b2
Show file tree
Hide file tree
Showing 33 changed files with 771 additions and 116,802 deletions.
15 changes: 15 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
tests/ export-ignore
phpunit.xml export-ignore
.git* export-ignore
.php_cs export-ignore
.editorconfig export-ignore
CHANGELOG.md export-ignore
CONTRIBUTING.md export-ignore
ROADMAP.md export-ignore
resources/js export-ignore
resources/less export-ignore
mix-manifest.json export-ignore
package-lock.json export-ignore
package.json export-ignore
tailwind.config.js export-ignore
webpack.mix.js export-ignore
11 changes: 10 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
# Changelog

## v0.2.8 - 2020-10-16

**To upgrade from v0.2.5 to v0.2.6, please delete all the Enlighten tables and re-run the migrations in your local environment**

- The example group URLs now show the slug of the test class names instead of the ID, for the better readability and to preserve the same URLs after re-running the tests for the same run configuration.
- Add .gitattributes to prevent tests and other unnecessary files from being published.
- Fix for issues: https://github.com/StydeNet/enlighten/issues/12 https://github.com/StydeNet/enlighten/issues/11 and https://github.com/StydeNet/enlighten/issues/8
- Other minor fixes and improvements

## v0.2 - 2020-10-14

**To upgrade from v1 to v2, please delete all the Enlighten tables and re-run the migrations**
**To upgrade from v0.1 to v0.2, please delete all the Enlighten tables and re-run the migrations in your local environment**

### New features

Expand Down
53 changes: 49 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ There is no need to add endless docblocks to each API method, maintain dozens of
Enlighten your Laravel applications with a beautiful documentation generated automatically from your test suites, by doing so, your documentation will always be updated with the current version of your app.

If you have already invested a lot of time developing and testing your API you don't need to spend the same amount of time documenting it, we'll do that for you, you deserve it!

[Join us on Discord](https://discord.gg/hNCV6p)

## Introducing Laravel Enlighten

Expand All @@ -28,7 +30,7 @@ Now visit `/enlighten/` to navigate the documentation.

## Installation

1. Require the package with Composer:
First step: require the package with Composer:

```bash
composer require styde/enlighten --dev
Expand All @@ -45,7 +47,7 @@ If you are not using the Laravel package auto-discovery feature, please add the
];
```

2. Publish the package assets (CSS, JavaScript) to the public folder using Artisan:
Second step: publish the package assets (CSS, JavaScript) to the public folder using Artisan:

```bash
php artisan vendor:publish --tag=enlighten-build
Expand All @@ -58,9 +60,9 @@ php artisan vendor:publish --tag=enlighten-config
php artisan vendor:publish --tag=enlighten-views
```

3. Import the trait `Styde\Enlighten\Tests\EnlightenSetup` and call `$this->enlightenSetUp()` in the `setUp` method of your `TestCase`, for example:
Third step: import the trait `Styde\Enlighten\Tests\EnlightenSetup` and call `$this->enlightenSetUp()` in the `setUp` method of your `TestCase`, for example:

```
```php
<?php

namespace Tests;
Expand All @@ -77,6 +79,7 @@ class TestCase extends \Tests\TestCase

$this->setUpEnlighten();
}
}
```

*Note:* remember to include and use the trait `Styde\Enlighten\Tests\EnlightenSetup`.
Expand Down Expand Up @@ -170,6 +173,48 @@ If you want to include all the test-classes and methods in your documentation, y
];
```

You can also ignore classes and methods adding the `@enlighten {"ignore": true}` annotation to any class OR method, for example:

```php
/**
* @enlighten {"ignore": true}
*/
class IgnoreClassWithAnnotationTest extends TestCase
{
use RefreshDatabase;

/**
* @test
* @enlighten {"ignore": true}
*/
function does_not_export_test_methods_with_the_enlighten_ignore_annotation()
{
$this->assertExampleIsNotCreated();
}
}
```

If you'd like to do the opposite (include a class previously ignored via the configuration option) just add the @enlighten annotation to that class OR method:

```php
/**
* @enlighten
*/
class IncludeMethodWithAnnotationTest extends TestCase
{
/**
* @test
* @enlighten
*/
function export_test_method_with_the_enlighten_annotation_even_if_its_ignored_in_the_config()
{
$this->assertExampleIsCreated();
}
}
```

**Note:** the annotations take precedence over the configuration option.

## Customizing titles and descriptions
If you want to have more control on the titles of the classes and methods, or add descriptions to each group or example, you can add the following annotations in your test classes and methods:

Expand Down
15 changes: 0 additions & 15 deletions ROADMAP.md

This file was deleted.

Loading

0 comments on commit 217b9b2

Please sign in to comment.