Skip to content

Commit

Permalink
No need for json and serialize test assertions
Browse files Browse the repository at this point in the history
Since the parser gives us a native PHP variable, it is not necessary
to perform assertions with json_encode() and serialize().
  • Loading branch information
dregad committed Apr 30, 2016
1 parent dc96f5a commit 03513dd
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions tests/Mantis/ConfigParserTest.php
Expand Up @@ -91,18 +91,15 @@ private function checkParserArray( $p_text, $p_expected_array ) {
# Check that the parsed array matches the model array
$t_parser = new ConfigParser( $p_text );
$t_parsed = $t_parser->parse();
$this->assertEquals( json_encode( $p_expected_array ), json_encode( $t_parsed ), $t_message );
$this->assertEquals( serialize( $p_expected_array ), serialize( $t_parsed ), $t_message );
$this->assertEquals( $t_parsed, $p_expected_array, $t_message );

# Export the converted array, and parse again.
# The result should match both the model and the previously parsed array
$t_export = var_export( $p_expected_array , true );
$t_parser = new ConfigParser( $t_export );
$t_parsed2 = $t_parser->parse();
$this->assertEquals( json_encode( $p_expected_array ), json_encode( $t_parsed2 ), $t_message );
$this->assertEquals( json_encode( $t_parsed ), json_encode( $t_parsed2 ), $t_message );
$this->assertEquals( serialize( $p_expected_array ), serialize( $t_parsed2 ), $t_message );
$this->assertEquals( serialize( $t_parsed ), serialize( $t_parsed2 ), $t_message );
$this->assertEquals( $t_parsed2, $p_expected_array, $t_message );
$this->assertEquals( $t_parsed2, $t_parsed, $t_message );
}

/**
Expand Down

0 comments on commit 03513dd

Please sign in to comment.