Skip to content

Commit

Permalink
Add unit tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
ivopetkov committed Dec 3, 2021
1 parent 38686ca commit 6d08271
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 0 deletions.
3 changes: 3 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
"ivopetkov/html5-dom-document-php": "2.*",
"ivopetkov/data-index-bearframework-addon": "1.*"
},
"require-dev": {
"bearcms/addon-tests": "1.*"
},
"autoload": {
"files": [
"autoload.php"
Expand Down
14 changes: 14 additions & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<phpunit bootstrap="vendor/autoload.php">
<testsuites>
<testsuite name="">
<directory>./tests/</directory>
</testsuite>
</testsuites>
<coverage>
<include>
<directory>./components/</directory>
<directory>./locales/</directory>
<file>./index.php</file>
</include>
</coverage>
</phpunit>
28 changes: 28 additions & 0 deletions tests/SearchBoxElementTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

/*
* Search box element addon for Bear CMS
* https://github.com/bearcms/search-box-element-addon
* Copyright (c) Amplilabs Ltd.
* Free to use under the MIT license.
*/

/**
* @runTestsInSeparateProcesses
*/
class SearchBoxElementTest extends BearCMS\AddonTests\PHPUnitTestCase
{
/**
*
*/
public function testOutput()
{
$app = $this->getApp();

$html = '<bearcms-search-box-element/>';
$result = $app->components->process($html);

$this->assertTrue(strpos($result, '<div class="bearcms-search-box-element"') !== false);
$this->assertTrue(strpos($result, 'class="bearcms-search-box-element-input"') !== false);
}
}

0 comments on commit 6d08271

Please sign in to comment.