add simple testing
This commit is contained in:
parent
18495dbbc3
commit
766b9a4d1e
5 changed files with 148 additions and 0 deletions
15
tests/bootstrap.php
Normal file
15
tests/bootstrap.php
Normal file
|
@ -0,0 +1,15 @@
|
|||
<?php
|
||||
|
||||
$_tests_dir = getenv('WP_TESTS_DIR');
|
||||
if ( !$_tests_dir ) $_tests_dir = '/tmp/wordpress-tests-lib';
|
||||
|
||||
require_once $_tests_dir . '/includes/functions.php';
|
||||
|
||||
function _manually_load_plugin() {
|
||||
require dirname( __FILE__ ) . '/../freifunk-versions.php';
|
||||
}
|
||||
tests_add_filter( 'muplugins_loaded', '_manually_load_plugin' );
|
||||
|
||||
require $_tests_dir . '/includes/bootstrap.php';
|
||||
|
||||
|
21
tests/test-simple.php
Normal file
21
tests/test-simple.php
Normal file
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
|
||||
class SimpleTests extends WP_UnitTestCase {
|
||||
function test_beautify() {
|
||||
$cmplist = array( // examples with and without grep param
|
||||
array('tp-link-tl-wr740n-nd', '', 'TP-Link TL-WR740N ND'),
|
||||
array('tp-link-tl-wr740n-nd', 'tp-link', 'TL-WR740N ND'),
|
||||
array('tp-link-tl-wdr4300', '', 'TP-Link TL-WDR4300'),
|
||||
array('tp-link-tl-wdr4300', 'tp-link', 'TL-WDR4300'),
|
||||
array('ubiquiti-unifi', '', 'Ubiquiti Unifi'),
|
||||
array('ubiquiti-unifi', 'ubiquiti', 'Unifi'),
|
||||
array('ubiquiti-bullet-m', '', 'Ubiquiti Bullet M2 / Nanostation Loco M2'),
|
||||
array('ubiquiti-bullet-m', 'ubiquiti', 'Bullet M2 / Nanostation Loco M2'),
|
||||
array('d-link-dir-615-rev-e1', '', 'D-Link DIR-615 rev e1'),
|
||||
array('d-link-dir-615-rev-e1', 'd-link', 'DIR-615 rev e1'),
|
||||
);
|
||||
foreach ($cmplist as $item) {
|
||||
$this->assertEquals($item[2], trim(ff_hh_beautify_hw_name($item[0], $item[1])));
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue