<?php

class ParserTest extends \PHPUnit_Framework_TestCase
{
    public function testStrSuccesses() {
      $this->assertTrue(
        Parser::str('abc')->run('abcdef')->equal(new Good('abc', 3))
      );

      $this->assertTrue(
        Parser::product(
          Parser::str('ab'),
          Parser::str('cd')
        )->run('abcd')
         ->equal(new Good(array('ab', 'cd'), 4))
      );
    }
}


<?php

class ParserTest extends \PHPUnit_Framework_TestCase
{
    public function testStrSuccesses() {
      $this->assertTrue(
        Parser::str('abc')->run('abcdef')->equal(new Good('abc', 3))
      );

      $this->assertEquals(
        Parser::product(
          Parser::str('ab'),
          Parser::str('cd')
        )->run('abcd'),
        new Good(array('ab', 'cd'), 4),
        'Parsing product'
      );

      $this->assertEquals(
        Parser::str('abc')->chain(function ($s) {
          return Parser::str(strtoupper($s));
        })->run('abcABC'), new Good('ABC', 6),
        'Contextual parsing'
      );
    }
}


Add test for Parser::chain which allows for contextual parsing.
Add test for Parser::chain which allows for contextual parsing.
