parse_name() public method

This is the primary method which calls all other methods
public parse_name ( $full_name ) : array
return array returns associative array of name parts
 /**
  * @dataProvider disfunctionalNameProvider
  */
 public function testBadNames($name, $expected_result)
 {
     $parser = new FullNameParser();
     $split_name = $parser->parse_name($name, true);
     $array_equal = $split_name === $expected_result;
     // These tests pass because the expected results do NOT match the actual results.
     $this->assertFalse($array_equal);
 }
Ejemplo n.º 2
0
 protected function parseName($full_name)
 {
     $parser = new \FullNameParser();
     return $parser->parse_name($full_name);
 }
foreach ($headers as $col) {
    ?>
            <th><?php 
    echo ucfirst($col);
    ?>
</th>
<?php 
}
?>
            <th>Passed</th>
          </tr>
        </thead>
        <tbody>
<?php 
foreach ($names as $name => $expected_values) {
    $split_name = $parser->parse_name($name);
    $passed = $split_name === $expected_values;
    ?>
          <tr class="<?php 
    echo $passed ? 'pass' : 'fail';
    ?>
">
            <td><?php 
    echo $name;
    ?>
</td>
<?php 
    foreach ($headers as $col) {
        ?>
            <td><?php 
        echo isset($split_name[$col]) ? $split_name[$col] : '';