Skip to content
This repository was archived by the owner on Mar 5, 2023. It is now read-only.

update to github template + dependencies #84

Draft
wants to merge 25 commits into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
0a6c9e6
update to github template + dependencies
joshbruce Oct 8, 2021
31029f3
Update composer.json
joshbruce Oct 8, 2021
d97427c
Update composer.lock
joshbruce Oct 8, 2021
819d057
anchor, image, page-title, simple-list passing stan checks
joshbruce Oct 8, 2021
6e918ba
Delete WebView.php
joshbruce Oct 8, 2021
7215d5f
Delete WebHead.php
joshbruce Oct 8, 2021
b6fc301
Delete SocialMeta.php
joshbruce Oct 8, 2021
57fb9c1
Delete Pagination.php
joshbruce Oct 8, 2021
f45e765
Delete Accordion.php
joshbruce Oct 8, 2021
21e9a9d
Delete DoubleWrap.php
joshbruce Oct 8, 2021
8912d67
Markdown passing stan
joshbruce Oct 8, 2021
26f0959
move feed to separate project
joshbruce Oct 8, 2021
be9a60f
remove html due to being separate project
joshbruce Oct 8, 2021
95bab00
Delete facades and proxies
joshbruce Oct 8, 2021
ffca936
update folder structure
joshbruce Oct 8, 2021
d925279
flatten hierarchy
joshbruce Oct 8, 2021
cf1ed57
flatten hierarchy - page title tests
joshbruce Oct 9, 2021
ad991c2
anchor tests + stan fixed
joshbruce Oct 9, 2021
f4ea54b
image, anchor pass tests + stan - beginning simple list
joshbruce Oct 9, 2021
3f65eef
apply buildable from XML Builder + update dependencies
joshbruce Oct 9, 2021
1c3a287
Merge branch 'main' into r1.0.0
joshbruce Jan 30, 2022
14bddcb
deprecated: Markdown class, use 8fold/commonmark-fluent-markdown
joshbruce Jan 30, 2022
6b57be8
deprecated: Description list
joshbruce Jan 30, 2022
20775c1
prepared for release
joshbruce Jan 30, 2022
307c8ab
update: Tests to use PHP 8.1
joshbruce Jan 30, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
@@ -12,6 +12,6 @@ insert_final_newline = true
indent_style = space
indent_size = 4

[*{.js,.json,.scss}]
[*.{ym,yaml,js,json,scss}]
indent_style = space
indent_size = 2
17 changes: 12 additions & 5 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
# Contributing

Contributions are **welcome** and will be **credited**. We accept contributions via Pull Requests on [GitHub](https://github.com/8fold/php-markup).
Contributions are **welcome** and will be **credited**. We accept contributions via Pull Requests on [GitHub](https://github.com/8fold/php-shoop).

## Goals
## Priorities

- Readability over speed over cleverness.
- Fail gracefully not by blowing things up.
We leverage GitHub's labeling system to inform prioritization of issues. The higher the number, the higher priority.

### Overall
Security is always the highest priority within the applicable scope of the product. Therefore, some packages are low-level and intended for developers and give the flexibility to them to surround the package with a security layer.

## Overall goals (philosophy and values)

There are a lot of philosphical things tied in to the way we strive to do software development. Some you are most likely familiar with, others maybe not so much.

@@ -27,6 +28,8 @@ There are a lot of philosphical things tied in to the way we strive to do softwa

**Solutions over scapegoats:** There are times when these principles will not be followed or someone will make a mistake. Berating the offender doesn't get any of us any closer to improving the execution of these principles.

**The Community Principle:** If you create or acquire it you help maintain it; time, food, money, and so on.

## Code promotion

Capabilities should be implemented at a low, concrete level before being promoted to higher-levels and made more abstract.
@@ -38,3 +41,7 @@ If the language being used allows access levels on variable, constants, methods,
This reduces the size of the public API, which makes the class easier to consume by developers.

Further, it is preferred that class properties remain private, always. This means pre- and post-processing for setting and getting properties can be added without being a breaking change to developers.

## Releasing

Major - fix bugs -> Patch - optimize -> Minor - fix bugs -> Patch - new feature -> Minor - interface changes -> Major
10 changes: 10 additions & 0 deletions .github/ISSUE_TEMPLATE/Deprecation_notice_or_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
name: Deprecation Notice or Request
about: Notify or request a feature be deprecated
---

**What feature should be deprecated?**

**Why should the feature be deprecated?**

**What alternative means delivers similar or same results?**
6 changes: 1 addition & 5 deletions .github/LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2019 Josh Bruce
Copyright (c) 2021 8fold

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@@ -19,7 +19,3 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

## Notice

This software makes use of software developed by others. Those software applications are not subject to this license, nor is this software subject to those licenses. See the individual modules for further details.
File renamed without changes.
14 changes: 14 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE/deprecation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
name: Deprecation Notice or Request
about: Notify or request a feature be deprecated
---

**What feature should be deprecated?**

**Why should the feature be deprecated?**

**What alternative means delivers similar or same results?**

## List of issues fixed

[Please use GitHub notation to automatically close the issues: Fixes #{issue number}]
5 changes: 0 additions & 5 deletions .github/PULL_REQUEST_TEMPLATE/issue.md

This file was deleted.

2 changes: 1 addition & 1 deletion .github/SECURITY.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Security Policy

The only completely secure system is the one that doesn't exist in the first place. Having said that, we take the security of Marked very seriously.
The only completely secure system is the one that doesn't exist in the first place. Having said that, we take security seriously.

## Reporting a Vulnerability

30 changes: 30 additions & 0 deletions .github/coding-standards-and-styles.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Coding Standards and Styles

Coding standards help multiple developers work in the same codebase and not have to answer certain questions because they are already answered by the standards. Further, whenever possible, if the language being discussed has community accepted standards or a governing body, those standards should be used. Finally, minimal exceptions can be made with just cause so long as those changes minimize cognitive load across the majority of developers working in the various codebases.

For example, the [w3c](https://www.w3.org/) is the generally accepted governing body for HTML and CSS; therefore, when it comes to answering questions or disputes related to HTML or CSS, that's where one should go. ECMAScript is the generally accepted standard for JavaScript. And, the PHP Framework Interop Group \([PHP-Fig](https://www.php-fig.org)\) is the same for PHP.

Therefore, if I, as a developer, go from the 8fold Component, to Laravel, to AMOS, there are certain conventions I should be able to reasonably expect.

## PHP

Standards come in the form of PHP Standards Recommendations \([PSRs](https://www.php-fig.org/psr/)\) proposals are made, debated, modified, and potentially accepted. As the PHP-FIG discusses proposals that could impact all PHP developers, the PSRs are generally not accepted lightly.

If no commentary is added for a specific PSR or section of a PSR, it is safe to assume following the full specification is desired. Modifications and extensions will be indicated by _italics_.

* [**PSR-1**](https://www.php-fig.org/psr/psr-1/)**:**
* PSR-1 is the base recommendation and is required by both of the following recommendations.
* [**PSR-2**](https://www.php-fig.org/psr/psr-2/)**:**
* As visibility is required and the following are not, `abstract`, `final`, _and_ `static` must precede visibility. If `static` is present, it must come directly before the visibility. _These modifications front-load the answering of the following questions in turn: Do I need to implement it? Can I override it? Is it a class function or instance method? From where can I see it, if at all?
* Opening braces for control structures MUST go on the same line, and closing braces MUST go on the next line after the body. _The body of a control structure SHOULD be followed by a blank line to distinguish between discreet thoughts. The body MAY be preceded by a blank line to reduce visual complexity and minimize blurring the lines._
* [**PSR-12**](https://github.com/php-fig/fig-standards/blob/master/proposed/extended-coding-style-guide.md)**:** This PSR is under review. With that said, it is the primary recommendation followed. Specifically-multi line control structures.
* 2.5: _Unless a library we use needs something else. At which point we should notify the library authors._
* 4.4: _See modifications from PSR-2._
* 4.5: _Any method returning a value MUST declare a return type. Methods SHOULD NOT return null (void is exception), favoring an empty value of the correct type. Wildcard arguments that can be of_ any _type SHOULD be avoided, and arguments SHOULD have a type specified._
* 5.1: _See modifications from PSR-2 regarding ordering._
* 5.2: _See modifications from PSR-2 regarding control structures._
* 5.6: _See modifications from PSR-2 regarding control structures._
* 6: _Ternary operators SHOULD NOT be used unless simple in form and MUST NOT be more than one unless as an artifact of a library being used. Unary operators SHOULD be avoided to clearly express the intent and reduce possible ordering problems \(ex. x-- may not be the same as --x; whereas x-y and y-x is clearly understood\)._
* **Other**
* Variables SHOULD NOT be nullable. Instead of null, use an empty variation of the same type. This reduces boilerplate null-checking code.

31 changes: 0 additions & 31 deletions .github/workflows/php.yml

This file was deleted.

31 changes: 0 additions & 31 deletions .github/workflows/php8.yml

This file was deleted.

34 changes: 34 additions & 0 deletions .github/workflows/php81.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: PHP 8.0

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup PHP Action
uses: shivammathur/setup-php@2.15.0
with:
php-version: '8.1'

- name: Validate composer.json and composer.lock
run: composer validate

- name: Install dependencies
run: composer install --prefer-dist --no-progress

- name: Run style check
run: composer run style

- name: Run static analyzer
run: composer run stan

- name: Run tests
run: composer run test
12 changes: 3 additions & 9 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "8fold/php-markup",
"description": "8fold Markup seeks to make writing semi-structured data easier while allowing for more dynamism.",
"description": "8fold Markup makes writing semi-structured data easier while allowing for more dynamism.",
"type": "library",
"license": "MIT",
"authors": [
@@ -25,8 +25,7 @@
},
"autoload-dev": {
"psr-4": {
"Eightfold\\Markup\\Tests\\": "./tests/",
"Eightfold\\Foldable\\Tests\\": "./vendor/8fold/php-foldable/tests/"
"Eightfold\\Markup\\Tests\\": "./tests/"
}
},
"config": {
@@ -41,13 +40,8 @@
"@stan",
"@test"
],
"deploy": [
"@production",
"@optimize-autoload"
],
"style": "./vendor/bin/phpcs --standard=phpcs.xml",
"stan": "./vendor/bin/phpstan analyze",
"test": "./vendor/bin/phpunit",
"optimize-autoload": "composer dumpautoload --no-dev --classmap-authoritative"
"test": "./vendor/bin/phpunit"
}
}
5 changes: 1 addition & 4 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion phpcs.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?xml version="1.0"?>
<ruleset name="8fold PSR12">
<description>PHP-FIG PSR-12 standards with modifications to: control structure (empty space before closing brace).</description>

<file>src</file>

<arg name="colors" />
2 changes: 0 additions & 2 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -4,5 +4,3 @@ parameters:
- src
ignoreErrors:
- '#Call to an undefined static method Eightfold\\HTMLBuilder\\Element::(.*)#'
- '#Call to an undefined static method Eightfold\\XMLBuilder\\Element::(.*)#'
- '#Call to an undefined static method Eightfold\\XMLBuilder\\Document::(.*)#'
35 changes: 17 additions & 18 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -11,22 +11,21 @@
processIsolation="false"
stopOnFailure="false"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<coverage>
<include>
<directory suffix=".php">./src/</directory>
</include>
<exclude>
<directory>vendor/</directory>
</exclude>
</coverage>
<testsuites>
<testsuite name="base">
<directory suffix="Test.php">./tests/</directory>
</testsuite>
</testsuites>
<php>
<ini name="display_errors" value="On"/>
<ini name="display_startup_errors" value="On"/>
</php>

<coverage>
<include>
<directory suffix=".php">./src/</directory>
</include>
<exclude>
<directory>vendor/</directory>
</exclude>
</coverage>
<testsuites>
<testsuite name="base">
<directory suffix="Test.php">./tests/</directory>
</testsuite>
</testsuites>
<php>
<ini name="display_errors" value="On"/>
<ini name="display_startup_errors" value="On"/>
</php>
</phpunit>
50 changes: 50 additions & 0 deletions src/Anchor.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?php

namespace Eightfold\Markup;

use Eightfold\XMLBuilder\Contracts\Buildable;

use Eightfold\HTMLBuilder\Element as HtmlElement;

class Anchor implements Buildable
{
private string $content = '';

private string $href = '';

/**
* @var array<string>
*/
private array $properties = [];

public static function create(string $content, string $href): Anchor
{
return new Anchor($content, $href);
}

public function __construct(string $content, string $href)
{
$this->content = $content;

$this->href = $href;
}

public function props(string ...$properties): Anchor
{
$this->properties = $properties;

return $this;
}

public function build(): string
{
return HtmlElement::a($this->content)
->props('href ' . $this->href, ...$this->properties)
->build();
}

public function __toString(): string
{
return $this->build();
}
}
149 changes: 0 additions & 149 deletions src/Element.php

This file was deleted.

28 changes: 0 additions & 28 deletions src/Feed.php

This file was deleted.

110 changes: 0 additions & 110 deletions src/Feed/Rss/Channel.php

This file was deleted.

118 changes: 0 additions & 118 deletions src/Feed/Rss/Item.php

This file was deleted.

23 changes: 0 additions & 23 deletions src/Filters/AttrDictionary.php

This file was deleted.

25 changes: 0 additions & 25 deletions src/Filters/AttrString.php

This file was deleted.

131 changes: 0 additions & 131 deletions src/Filters/AttrStringHtml.php

This file was deleted.

19 changes: 0 additions & 19 deletions src/Html.php

This file was deleted.

32 changes: 0 additions & 32 deletions src/Html/HtmlElement.php

This file was deleted.

52 changes: 52 additions & 0 deletions src/Image.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<?php

namespace Eightfold\Markup;

use Eightfold\XMLBuilder\Contracts\Buildable;

use Eightfold\HTMLBuilder\Element as HtmlElement;

class Image implements Buildable
{
private string $alt = '';

private string $src = '';

/**
* @var array<string>
*/
private array $properties = [];

public static function create(string $alt, string $src): Image
{
return new Image($alt, $src);
}

public function __construct(string $alt, string $src)
{
$this->alt = $alt;
$this->src = $src;
}

public function props(string ...$properties): Image
{
$this->properties = $properties;

return $this;
}

public function build(): string
{
return HtmlElement::img()->omitEndTag()
->props(
'alt ' . $this->alt,
'src ' . $this->src,
...$this->properties
)->build();
}

public function __toString(): string
{
return $this->build();
}
}
77 changes: 77 additions & 0 deletions src/PageTitle.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<?php

namespace Eightfold\Markup;

use Eightfold\XMLBuilder\Contracts\Buildable;

use Eightfold\HTMLBuilder\Element as HtmlElement;

class PageTitle implements Buildable
{
/**
* @var array<string>
*/
private array $parts = [];

private string $separator = ' | ';

private bool $reversed = false;

private bool $stringOnly = false;

/**
* @param array<string> $parts [description]
*/
public static function create(
array $parts,
string $separator = ' | '
): PageTitle {
return new PageTitle($parts, $separator);
}

/**
* @param array<string> $parts [description]
*/
public function __construct(array $parts, string $separator = ' | ')
{
$this->parts = $parts;

$this->separator = $separator;
}

public function build(): string
{
if ($this->reversed) {
$this->parts = array_reverse($this->parts);

}

$string = implode($this->separator, $this->parts);

if ($this->stringOnly) {
return $string;

}

return HtmlElement::title($string)->build();
}

public function __toString(): string
{
return $this->build();
}

public function reversed(): PageTitle
{
$this->reversed = true;

return $this;
}

public function stringOnly(): PageTitle
{
$this->stringOnly = true;

return $this;
}
}
72 changes: 72 additions & 0 deletions src/SimpleList.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
<?php

namespace Eightfold\Markup;

use Eightfold\XMLBuilder\Contracts\Buildable;

use Eightfold\HTMLBuilder\Element as HtmlElement;

class SimpleList implements Buildable
{
/**
* @var array<HtmlElement|string>
*/
private array $items = [];

private string $type = 'unordered';

/**
* @var array<string>
*/
private array $properties = [];

public static function create(string|Buildable ...$items): SimpleList
{
return new SimpleList(...$items);
}

/**
* @param HtmlElement|string $items [description]
*/
public function __construct(string|Buildable ...$items)
{
$this->items = $items;
}

public function props(string ...$properties): SimpleList
{
$this->properties = $properties;

return $this;
}

public function build(): string
{
$items = [];
foreach ($this->items as $item) {
$items[] = HtmlElement::li($item);
}

$elem = HtmlElement::ul(...$items);
if ($this->type === 'ordered') {
$elem = HtmlElement::ol(...$items);
}

if (count($this->properties) > 0) {
$elem = $elem->props(...$this->properties);
}

return $elem->build();
}

public function __toString(): string
{
return $this->build();
}

public function ordered(): SimpleList
{
$this->type = 'ordered';
return $this;
}
}
238 changes: 0 additions & 238 deletions src/UIKit.php

This file was deleted.

60 changes: 0 additions & 60 deletions src/UIKit/Elements/Compound/Accordion.php

This file was deleted.

47 changes: 0 additions & 47 deletions src/UIKit/Elements/Compound/DoubleWrap.php

This file was deleted.

92 changes: 0 additions & 92 deletions src/UIKit/Elements/Compound/Markdown.php

This file was deleted.

230 changes: 0 additions & 230 deletions src/UIKit/Elements/Compound/Pagination.php

This file was deleted.

75 changes: 0 additions & 75 deletions src/UIKit/Elements/Compound/SocialMeta.php

This file was deleted.

150 changes: 0 additions & 150 deletions src/UIKit/Elements/Compound/WebHead.php

This file was deleted.

51 changes: 0 additions & 51 deletions src/UIKit/Elements/Pages/WebView.php

This file was deleted.

22 changes: 0 additions & 22 deletions src/UIKit/Elements/Simple/Anchor.php

This file was deleted.

20 changes: 0 additions & 20 deletions src/UIKit/Elements/Simple/Image.php

This file was deleted.

56 changes: 0 additions & 56 deletions src/UIKit/Elements/Simple/PageTitle.php

This file was deleted.

87 changes: 0 additions & 87 deletions src/UIKit/Elements/Simple/SimpleList.php

This file was deleted.

48 changes: 48 additions & 0 deletions tests/AnchorTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?php

declare(strict_types=1);

namespace Eightfold\Markup\Tests;

use PHPUnit\Framework\TestCase;

use Eightfold\Markup\Anchor;

class AnchorTest extends TestCase
{
/**
* @test
*/
public function anchor_is_castable_to_string(): void
{
$this->assertEquals(
(string) Anchor::create('link content', 'https://8fold.pro')
->props('class some-class', 'id some-id'),
'<a id="some-id" class="some-class" href="https://8fold.pro">link content</a>'
);
}

/**
* @test
*/
public function anchor_can_have_custom_properties(): void
{
$this->assertEquals(
Anchor::create('link content', 'https://8fold.pro')
->props('class some-class', 'id some-id')
->build(),
'<a id="some-id" class="some-class" href="https://8fold.pro">link content</a>'
);
}

/**
* @test
*/
public function anchor_returns_correct_element_with_required_parts(): void
{
$this->assertEquals(
Anchor::create('link content', 'https://8fold.pro')->build(),
'<a href="https://8fold.pro">link content</a>'
);
}
}
186 changes: 0 additions & 186 deletions tests/Element/ElementTest.php

This file was deleted.

56 changes: 0 additions & 56 deletions tests/Feed/Rss/RssTest.php

This file was deleted.

191 changes: 0 additions & 191 deletions tests/Html/HtmlElementTest.php

This file was deleted.

48 changes: 48 additions & 0 deletions tests/ImageTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?php

declare(strict_types=1);

namespace Eightfold\Markup\Tests;

use PHPUnit\Framework\TestCase;

use Eightfold\Markup\Image;

class ImageTest extends TestCase
{
/**
* @test
*/
public function image_is_castable_to_string(): void
{
$this->assertEquals(
(string) Image::create('alt content', 'https://8fold.pro')
->props('class some-class', 'id some-id'),
'<img id="some-id" class="some-class" src="https://8fold.pro" alt="alt content">'
);
}

/**
* @test
*/
public function image_can_have_custom_properties(): void
{
$this->assertEquals(
Image::create('alt content', 'https://8fold.pro')
->props('class some-class', 'id some-id')
->build(),
'<img id="some-id" class="some-class" src="https://8fold.pro" alt="alt content">'
);
}

/**
* @test
*/
public function image_returns_correct_element_with_required_parts(): void
{
$this->assertEquals(
Image::create('alt content', 'https://8fold.pro')->build(),
'<img src="https://8fold.pro" alt="alt content">'
);
}
}
69 changes: 69 additions & 0 deletions tests/PageTitleTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
<?php

declare(strict_types=1);

namespace Eightfold\Markup\Tests;

use PHPUnit\Framework\TestCase;

use Eightfold\Markup\PageTitle;

class PageTitleTest extends TestCase
{
/**
* @test
*/
public function page_title_is_castable_to_string(): void
{
$this->assertEquals(
(string) PageTitle::create(['Hello!', 'How are you?'], ' : ')
->reversed(),
'<title>How are you? : Hello!</title>'
);
}

/**
* @test
*/
public function page_title_can_return_with_tag(): void
{
$this->assertEquals(
PageTitle::create(['Hello!', 'How are you?'], ' : ')->reversed()
->stringOnly()->build(),
'How are you? : Hello!'
);
}

/**
* @test
*/
public function page_title_respects_custom_separator(): void
{
$this->assertEquals(
PageTitle::create(['Hello!', 'How are you?'], ' : ')->build(),
'<title>Hello! : How are you?</title>'
);
}

/**
* @test
*/
public function page_title_can_have_multiple_parts(): void
{
$this->assertEquals(
PageTitle::create(['Hello!', 'How are you?'])->build(),
'<title>Hello! | How are you?</title>'
);
}

/**
* @test
*/
public function page_title_returns_correct_element(): void
{
$this->assertEquals(
PageTitle::create(['Hello!'])->build(),
'<title>Hello!</title>'
);
}
}
65 changes: 65 additions & 0 deletions tests/SimpleListTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<?php

declare(strict_types=1);

namespace Eightfold\Markup\Tests;

use PHPUnit\Framework\TestCase;

use Eightfold\Markup\SimpleList;

use Eightfold\Markup\Anchor;

class SimpleListTest extends TestCase
{
/**
* @test
*/
public function list_is_castable_to_string(): void
{
$this->assertEquals(
(string) SimpleList::create('list item'),
'<ul><li>list item</li></ul>'
);
}

/**
* @test
*/
public function list_can_have_custom_properties(): void
{
$this->assertEquals(
SimpleList::create(
'list item',
Anchor::create('hello', 'file://example.pdf')
)->props('class some-class', 'id some-id')->build(),
'<ul id="some-id" class="some-class"><li>list item</li><li><a href="file://example.pdf">hello</a></li></ul>'
);
}

/**
* @test
*/
public function list_can_be_ordered(): void
{
$this->assertEquals(
SimpleList::create(
'list item'
)->ordered()->build(),
'<ol><li>list item</li></ol>'
);
}

/**
* @test
*/
public function list_returns_correct_default_element_with_required_parts(): void
{
$this->assertEquals(
SimpleList::create(
'list item'
)->build(),
'<ul><li>list item</li></ul>'
);
}
}
109 changes: 0 additions & 109 deletions tests/UIKit/CompoundTest.php

This file was deleted.

139 changes: 0 additions & 139 deletions tests/UIKit/MarkdownTest.php

This file was deleted.

39 changes: 0 additions & 39 deletions tests/UIKit/PageTest.php

This file was deleted.

Loading