Skip to content

Commit

Permalink
Working on next version
Browse files Browse the repository at this point in the history
  • Loading branch information
GrahamCampbell committed Feb 25, 2023
1 parent 3969aef commit d022ce5
Show file tree
Hide file tree
Showing 16 changed files with 108 additions and 108 deletions.
24 changes: 20 additions & 4 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,17 @@ jobs:

strategy:
matrix:
php: ['7.4', '8.0', '8.1']
laravel: ['8', '9']
php: ['7.4', '8.0', '8.1', '8.2']
laravel: ['8', '9', '10']
exclude:
- php: '7.4'
laravel: '9'
- php: '7.4'
laravel: '10'
- php: '8.0'
laravel: '10'
- php: '8.2'
laravel: '8'

steps:
- name: Checkout Code
Expand All @@ -27,6 +33,8 @@ jobs:
php-version: ${{ matrix.php }}
tools: composer:v2
coverage: none
env:
update: true

- name: Setup Problem Matchers
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
Expand All @@ -36,17 +44,25 @@ jobs:
with:
timeout_minutes: 5
max_attempts: 5
command: composer require "laravel/framework:^8.75" --no-update --no-interaction
command: composer require "laravel/framework:^8.83.27" "phpunit/phpunit:^9.6.3" --no-update --no-interaction
if: "matrix.laravel == '8'"

- name: Select Laravel 9
uses: nick-invision/retry@v2
with:
timeout_minutes: 5
max_attempts: 5
command: composer require "laravel/framework:^9.0" --no-update --no-interaction
command: composer require "laravel/framework:^9.52.4" "phpunit/phpunit:^9.6.3" --no-update --no-interaction
if: "matrix.laravel == '9'"

- name: Select Laravel 10
uses: nick-invision/retry@v2
with:
timeout_minutes: 5
max_attempts: 5
command: composer require "laravel/framework:^10.1.5" "phpunit/phpunit:^10.0.12" --no-update --no-interaction
if: "matrix.laravel == '10'"

- name: Install PHP Dependencies
uses: nick-invision/retry@v2
with:
Expand Down
28 changes: 12 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Laravel Markdown was created by, and is maintained by [Graham Campbell](https://
![Banner](https://user-images.githubusercontent.com/2829600/71477505-680d0f80-27e2-11ea-94a6-b4bacb08e270.png)

<p align="center">
<a href="https://github.com/GrahamCampbell/Laravel-Markdown/actions?query=workflow%3ATests"><img src="https://img.shields.io/github/workflow/status/GrahamCampbell/Laravel-Markdown/Tests?label=Tests&style=flat-square" alt="Build Status"></img></a>
<a href="https://github.com/GrahamCampbell/Laravel-Markdown/actions?query=workflow%3ATests"><img src="https://img.shields.io/github/actions/workflow/status/GrahamCampbell/Laravel-Markdown/tests.yml?label=Tests&style=flat-square" alt="Build Status"></img></a>
<a href="https://github.styleci.io/repos/15090687"><img src="https://github.styleci.io/repos/15090687/shield" alt="StyleCI Status"></img></a>
<a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-brightgreen?style=flat-square" alt="Software License"></img></a>
<a href="https://packagist.org/packages/graham-campbell/markdown"><img src="https://img.shields.io/packagist/dt/graham-campbell/markdown?style=flat-square" alt="Packagist Downloads"></img></a>
Expand All @@ -16,25 +16,21 @@ Laravel Markdown was created by, and is maintained by [Graham Campbell](https://

## Installation

This version requires [PHP](https://www.php.net/) 7.4-8.1 and supports [Laravel](https://laravel.com/) 8-9.

| Markdown | L5.1 | L5.2 | L5.3 | L5.4 | L5.5 | L5.6 | L5.7 | L5.8 | L6 | L7 | L8 | L9 |
|----------|--------------------|--------------------|--------------------|--------------------|--------------------|--------------------|--------------------|--------------------|--------------------|--------------------|--------------------|--------------------|
| 5.3 | :white_check_mark: | :white_check_mark: | :x: | :x: | :x: | :x: | :x: | :x: | :x: | :x: | :x: | :x: |
| 6.1 | :white_check_mark: | :white_check_mark: | :white_check_mark: | :x: | :x: | :x: | :x: | :x: | :x: | :x: | :x: | :x: |
| 7.1 | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :x: | :x: | :x: | :x: | :x: | :x: | :x: | :x: |
| 8.1 | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :x: | :x: | :x: | :x: | :x: | :x: | :x: |
| 9.0 | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :x: | :x: | :x: | :x: | :x: | :x: | :x: |
| 10.3 | :x: | :x: | :x: | :x: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :x: | :x: | :x: | :x: |
| 11.2 | :x: | :x: | :x: | :x: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :x: | :x: |
| 12.0 | :x: | :x: | :x: | :x: | :x: | :x: | :x: | :x: | :white_check_mark: | :white_check_mark: | :x: | :x: |
| 13.1 | :x: | :x: | :x: | :x: | :x: | :x: | :x: | :x: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :x: |
| 14.0 | :x: | :x: | :x: | :x: | :x: | :x: | :x: | :x: | :x: | :x: | :white_check_mark: | :white_check_mark: |
This version requires [PHP](https://www.php.net/) 7.4-8.2 and supports [Laravel](https://laravel.com/) 8-10.

| Markdown | L5.5 | L5.6 | L5.7 | L5.8 | L6 | L7 | L8 | L9 | L10 |
|----------|--------------------|--------------------|--------------------|--------------------|--------------------|--------------------|--------------------|--------------------|--------------------|
| 10.3 | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :x: | :x: | :x: | :x: | :x: |
| 11.2 | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :x: | :x: | :x: |
| 12.0 | :x: | :x: | :x: | :x: | :white_check_mark: | :white_check_mark: | :x: | :x: | :x: |
| 13.1 | :x: | :x: | :x: | :x: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :x: | :x: |
| 14.0 | :x: | :x: | :x: | :x: | :x: | :x: | :white_check_mark: | :white_check_mark: | :x: |
| 15.0 | :x: | :x: | :x: | :x: | :x: | :x: | :white_check_mark: | :white_check_mark: | :white_check_mark: |

To get the latest version, simply require the project using [Composer](https://getcomposer.org/):

```bash
$ composer require graham-campbell/markdown:^14.0
$ composer require "graham-campbell/markdown:^15.0"
```

Once installed, if you are not using automatic package discovery, then you need to register the `GrahamCampbell\Markdown\MarkdownServiceProvider` service provider in your `config/app.php`.
Expand Down
22 changes: 10 additions & 12 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@
],
"require": {
"php": "^7.4.15 || ^8.0.2",
"illuminate/contracts": "^8.75 || ^9.0",
"illuminate/filesystem": "^8.75 || ^9.0",
"illuminate/support": "^8.75 || ^9.0",
"illuminate/view": "^8.75 || ^9.0",
"league/commonmark": "^2.3.1"
"illuminate/contracts": "^8.75 || ^9.0 || ^10.0",
"illuminate/filesystem": "^8.75 || ^9.0 || ^10.0",
"illuminate/support": "^8.75 || ^9.0 || ^10.0",
"illuminate/view": "^8.75 || ^9.0 || ^10.0",
"league/commonmark": "^2.3.9"
},
"require-dev": {
"graham-campbell/analyzer": "^3.1",
"graham-campbell/testbench": "^5.7",
"mockery/mockery": "^1.5",
"phpunit/phpunit": "^9.5"
"graham-campbell/analyzer": "^4.0",
"graham-campbell/testbench": "^6.0",
"mockery/mockery": "^1.5.1",
"phpunit/phpunit": "^9.6.3 || ^10.0.12"
},
"autoload": {
"psr-4": {
Expand All @@ -43,7 +43,5 @@
"GrahamCampbell\\Markdown\\MarkdownServiceProvider"
]
}
},
"minimum-stability": "dev",
"prefer-stable": true
}
}
38 changes: 11 additions & 27 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,29 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
beStrictAboutTestsThatDoNotTestAnything="true"
beStrictAboutOutputDuringTests="true"
bootstrap="vendor/autoload.php"
colors="true"
convertDeprecationsToExceptions="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
failOnRisky="true"
failOnWarning="true"
processIsolation="false"
stopOnError="false"
stopOnFailure="false"
verbose="true"
>
<testsuites>
<testsuite name="Laravel Markdown Test Suite">
<directory suffix="Test.php">./tests</directory>
</testsuite>
</testsuites>
<coverage processUncoveredFiles="true">
<include>
<directory suffix=".php">./src</directory>
</include>
</coverage>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="false" beStrictAboutTestsThatDoNotTestAnything="true" beStrictAboutOutputDuringTests="true" bootstrap="vendor/autoload.php" colors="true" failOnRisky="true" failOnWarning="true" processIsolation="false" stopOnError="false" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.0/phpunit.xsd">
<testsuites>
<testsuite name="Laravel Markdown Test Suite">
<directory suffix="Test.php">./tests</directory>
</testsuite>
</testsuites>
<coverage>
<include>
<directory suffix=".php">./src</directory>
</include>
</coverage>
</phpunit>
2 changes: 1 addition & 1 deletion src/Facades/Markdown.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class Markdown extends Facade
*
* @return string
*/
protected static function getFacadeAccessor()
protected static function getFacadeAccessor(): string
{
return 'markdown.converter';
}
Expand Down
2 changes: 1 addition & 1 deletion src/MarkdownServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ protected function registerDirective(): void
*
* @return string[]
*/
public function provides()
public function provides(): array
{
return [
'markdown.environment',
Expand Down
2 changes: 1 addition & 1 deletion src/View/Engine/BladeCommonMarkEngine.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function __construct(CompilerInterface $compiler, Filesystem $files, Conv
*
* @return string
*/
public function get($path, array $data = [])
public function get($path, array $data = []): string
{
$contents = parent::get($path, $data);

Expand Down
2 changes: 1 addition & 1 deletion src/View/Engine/PhpCommonMarkEngine.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function __construct(Filesystem $files, ConverterInterface $converter)
*
* @return string
*/
public function get($path, array $data = [])
public function get($path, array $data = []): string
{
$contents = parent::get($path, $data);

Expand Down
2 changes: 1 addition & 1 deletion tests/AbstractTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ abstract class AbstractTestCase extends AbstractPackageTestCase
*
* @return string
*/
protected function getServiceProviderClass()
protected static function getServiceProviderClass(): string
{
return MarkdownServiceProvider::class;
}
Expand Down
4 changes: 2 additions & 2 deletions tests/AnalysisTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class AnalysisTest extends TestCase
*
* @return string[]
*/
protected function getPaths()
protected static function getPaths(): array
{
return [
realpath(__DIR__.'/../config'),
Expand All @@ -43,7 +43,7 @@ protected function getPaths()
*
* @return string[]
*/
protected function getIgnored()
protected static function getIgnored(): array
{
return [Application::class];
}
Expand Down
18 changes: 9 additions & 9 deletions tests/Facades/MarkdownTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class MarkdownTest extends AbstractTestCase
*
* @return string
*/
protected function getFacadeAccessor()
protected static function getFacadeAccessor(): string
{
return 'markdown.converter';
}
Expand All @@ -43,7 +43,7 @@ protected function getFacadeAccessor()
*
* @return string
*/
protected function getFacadeClass()
protected static function getFacadeClass(): string
{
return Markdown::class;
}
Expand All @@ -53,28 +53,28 @@ protected function getFacadeClass()
*
* @return string
*/
protected function getFacadeRoot()
protected static function getFacadeRoot(): string
{
return ConverterInterface::class;
}

public function testConvertToHtml()
public function testConvertToHtml(): void
{
$result = Markdown::convert('foo');

$this->assertSame("<p>foo</p>\n", $result->getContent());
self::assertSame("<p>foo</p>\n", $result->getContent());
}

public function testDisallowingUnsafeLinks()
public function testDisallowingUnsafeLinks(): void
{
$this->app->config->set('markdown.allow_unsafe_links', false);

$result = Markdown::convert("[Click me](javascript:alert('XSS'))");

$this->assertSame("<p><a>Click me</a></p>\n", $result->getContent());
self::assertSame("<p><a>Click me</a></p>\n", $result->getContent());
}

public function testSmartPuncConversion()
public function testSmartPuncConversion(): void
{
$this->app->config->set('markdown.extensions', [
CommonMarkCoreExtension::class,
Expand All @@ -84,6 +84,6 @@ public function testSmartPuncConversion()

$result = Markdown::convert("'A', 'B', and 'C' are letters.");

$this->assertSame("<p>‘A’, ‘B’, and ‘C’ are letters.</p>\n", $result->getContent());
self::assertSame("<p>‘A’, ‘B’, and ‘C’ are letters.</p>\n", $result->getContent());
}
}
30 changes: 15 additions & 15 deletions tests/Functional/MarkdownViewTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,59 +27,59 @@ class MarkdownViewTest extends AbstractTestCase
*
* @return void
*/
protected function getEnvironmentSetUp($app)
protected function getEnvironmentSetUp($app): void
{
parent::getEnvironmentSetUp($app);

$app->view->addNamespace('stubs', realpath(__DIR__.'/stubs'));
}

public function testMarkdown()
public function testMarkdown(): void
{
$return = $this->app->view->make('stubs::test')->render();

$this->assertSame("<h1>Test</h1>\n", $return);
self::assertSame("<h1>Test</h1>\n", $return);
}

public function testPhpMarkdown()
public function testPhpMarkdown(): void
{
$return = $this->app->view->make('stubs::foo')->render();

$this->assertSame("<h1>Foo</h1>\n", $return);
self::assertSame("<h1>Foo</h1>\n", $return);
}

public function testBladeMarkdown()
public function testBladeMarkdown(): void
{
$return = $this->app->view->make('stubs::bar')->render();

$this->assertSame("<h1>Bar</h1>\n", $return);
self::assertSame("<h1>Bar</h1>\n", $return);
}

public function testBladeDirectiveInline()
public function testBladeDirectiveInline(): void
{
$return = $this->app->view->make('stubs::baz')->render();

$this->assertSame("<h1>Baz</h1>\n", $return);
self::assertSame("<h1>Baz</h1>\n", $return);
}

public function testBladeDirectiveBlock1()
public function testBladeDirectiveBlock1(): void
{
$return = $this->app->view->make('stubs::qux')->render();

$this->assertSame("<h1>Qux</h1>\n", $return);
self::assertSame("<h1>Qux</h1>\n", $return);
}

public function testBladeDirectiveBlock2()
public function testBladeDirectiveBlock2(): void
{
$return = $this->app->view->make('stubs::dir')->render();

$this->assertSame("<div>\n <p>foo\nbar</p>\n<pre><code>baz\n</code></pre>\n<p>bat</p>\n</div>\n", $return);
self::assertSame("<div>\n <p>foo\nbar</p>\n<pre><code>baz\n</code></pre>\n<p>bat</p>\n</div>\n", $return);
}

public function testBladeDirectiveBlock3()
public function testBladeDirectiveBlock3(): void
{
$return = $this->app->view->make('stubs::bad')->render();

$this->assertSame("<div>\n <pre><code>foo\n</code></pre>\n<p>baz</p>\n</div>\n", $return);
self::assertSame("<div>\n <pre><code>foo\n</code></pre>\n<p>baz</p>\n</div>\n", $return);
}
}
Loading

0 comments on commit d022ce5

Please sign in to comment.