View Issue Details

IDProjectCategoryView StatusLast Update
0016931mantisbtcode cleanuppublic2016-06-12 00:42
ReporterdregadAssigned Todregad 
PrioritylowSeverityminorReproducibilityN/A
Status closedResolutionfixed 
Product Version 
Target Version1.3.0-rc.2Fixed in Version1.3.0-rc.2 
Summary0016931: PHPUnit tests for admin config functions
Description

As suggested by rombert [1], these functions ought to be moved to a core API file. This will enable implementation of PHPUnit tests for them.

[1] https://github.com/mantisbt/mantisbt/pull/131#issuecomment-34314841

Additional Information

From rombert's comment on the pull request:

Some basic tests are quite easy to add, e.g.

    public function testSpecialSplit() {

        self::assertEquals(array('a', ' b'), special_split('a, b'));
    }

    public function testProcessSpecialValues() {

        self::assertEquals(array(1,2,3), process_complex_value('array(1, 2, 3)'));
        self::assertEquals(array(1,2,3), process_complex_value('array(1, 2, 3);'));
    }

    public function testConstantReplace() {

        self::assertEquals(ON, constant_replace('ON'));
        self::assertEquals('NotAConstant', constant_replace('NotAConstant'));
    }

Of course, there's much more to test

TagsNo tags attached.

Relationships

related to 0013298 closeddregad commas and multi-dimensional arrays in adm_config_set 
parent of 0016932 closeddregad Move functions defined in adm_config_set.php to a core API 
related to 0020787 closeddregad Setting of arrays (complex type) in Configuration Page doesn't work 

Activities

There are no notes attached to this issue.

Related Changesets

MantisBT: master 3ed60df1

2016-04-30 07:53:25

dregad

Details Diff
Parse complex configs using PHP tokenizer

Implements 2 classes to parse 'complex' config options in admin
Configuration Report page using PHP tokenizer instead of relying on
regular expressions.

- Tokenizer calls token_get_all() to build a list of tokens from the
given code
- Parser uses a Tokenizer object to convert the code (string) to an
actual PHP array variable

Includes PHPUnit test cases for the new parser code.

Fixes 0020787, 0020812, 0020813, 0020850, 0020851, 0016931, 0016932
PR https://github.com/mantisbt/mantisbt/pull/761
mod - adm_config_set.php Diff File
add - core/classes/ConfigParser.class.php Diff File
add - core/classes/Tokenizer.class.php Diff File
mod - core/constant_inc.php Diff File
mod - lang/strings_english.txt Diff File
mod - tests/Mantis/AllTests.php Diff File
add - tests/Mantis/ConfigParserTest.php Diff File

Issue History

Date Modified Username Field Change
2014-02-07 03:55 dregad New Issue
2014-02-07 03:55 dregad Relationship added related to 0013298
2014-02-07 03:56 dregad Relationship added parent of 0016932
2014-02-07 18:00 rombert Assigned To => rombert
2014-02-07 18:00 rombert Status new => assigned
2014-02-07 18:00 rombert Description Updated View Revisions
2014-02-07 18:00 rombert Additional Information Updated View Revisions
2014-12-08 02:10 atrol Target Version 1.3.0-beta.1 => 1.3.0-beta.2
2015-03-15 19:59 dregad Target Version 1.3.0-beta.2 => 1.3.0-beta.3
2015-09-06 17:47 vboctoradmin Target Version 1.3.0-beta.3 => 1.3.0-rc.1
2015-12-06 02:55 vboctor Target Version 1.3.0-rc.1 => 1.3.0-rc.2
2016-04-28 18:04 dregad Relationship added related to 0020787
2016-04-30 08:39 dregad Changeset attached => MantisBT master 3ed60df1
2016-04-30 08:42 dregad Status assigned => resolved
2016-04-30 08:42 dregad Fixed in Version => 1.3.0-rc.2
2016-04-30 08:42 dregad Resolution open => fixed
2016-04-30 08:43 dregad Assigned To rombert => dregad
2016-04-30 08:43 dregad Description Updated View Revisions
2016-04-30 08:43 dregad Additional Information Updated View Revisions
2016-06-12 00:42 vboctor Status resolved => closed