Skip to content

Commit 8835f34

Browse files
committed
Add unit tests.
1 parent 5533415 commit 8835f34

File tree

3 files changed

+45
-0
lines changed

3 files changed

+45
-0
lines changed

composer.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@
2121
"bearframework/localization-addon": "1.*",
2222
"ivopetkov/client-packages-bearframework-addon": "1.*"
2323
},
24+
"require-dev": {
25+
"bearcms/addon-tests": "1.*"
26+
},
2427
"autoload": {
2528
"files": [
2629
"autoload.php"

phpunit.xml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<phpunit bootstrap="vendor/autoload.php">
2+
<testsuites>
3+
<testsuite name="">
4+
<directory>./tests/</directory>
5+
</testsuite>
6+
</testsuites>
7+
<coverage>
8+
<include>
9+
<directory>./components/</directory>
10+
<directory>./locales/</directory>
11+
<file>./index.php</file>
12+
</include>
13+
</coverage>
14+
</phpunit>

tests/CodeElementTest.php

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
3+
/*
4+
* Social sharing addon for Bear Framework
5+
* https://github.com/ivopetkov/social-sharing-bearframework-addon
6+
* Copyright (c) Ivo Petkov
7+
* Free to use under the MIT license.
8+
*/
9+
10+
/**
11+
* @runTestsInSeparateProcesses
12+
*/
13+
class CodeElementTest extends BearCMS\AddonTests\PHPUnitTestCase
14+
{
15+
/**
16+
*
17+
*/
18+
public function testOutput()
19+
{
20+
$app = $this->getApp();
21+
22+
$html = '<bearcms-code-element code="test-code"/>';
23+
$result = $app->components->process($html);
24+
25+
$this->assertTrue(strpos($result, '<code class="bearcms-code-element"') !== false);
26+
$this->assertTrue(strpos($result, 'test-code') !== false);
27+
}
28+
}

0 commit comments

Comments
 (0)