public function grade(CodingExecutionResult $result)
 {
     $expected = 'Puppy';
     $result->assertOutputContains($expected);
     $result->assertElementContains('h2', $expected);
     $result->assertInputContains('homepage.twig', 'whatIWantForXmas');
 }
 public function grade(CodingExecutionResult $result)
 {
     $expected = 'our pets are purrfectly pawesome!';
     $result->assertInputContains('index.php', 'strrev(');
     $result->assertInputContains('index.php', 'strtolower(');
     $result->assertOutputContains($expected);
 }
 public function grade(CodingExecutionResult $result)
 {
     $expected = 'I luv puppies';
     $result->assertInputContains('index.php', 'echo');
     $result->assertOutputContains($expected);
     $result->assertElementContains('h2', $expected);
 }
 public function grade(CodingExecutionResult $result)
 {
     $result->assertInputContains('index.php', 'if');
     $result->assertInputContains('index.php', 'array_key_exists');
     // make sure they're still printing
     $result->assertOutputContains('no color', 'The `Bacon Bone` doesn\'t have a color, so it *should* say "no color" for that toy.');
     $result->assertElementContains('h4', 'Yellow');
 }
 public function grade(CodingExecutionResult $result)
 {
     $expected = 'I luv kittens';
     $result->assertOutputContains($expected);
     $result->assertElementContains('h2', $expected);
     $result->assertVariableEquals('airpupTag', $expected);
     $result->assertInputContains('index.php', 'echo');
 }
 public function grade(CodingExecutionResult $result)
 {
     // sanity checks to make sure they didn't just clear the file
     // mostly, we want them to fix the errors
     $expected = 'I luv kittens';
     $result->assertOutputContains($expected);
     $result->assertElementContains('h2', $expected);
     $result->assertElementContains('h2', 2015);
 }
 public function grade(CodingExecutionResult $result)
 {
     $expected = 'I luv puppies';
     $result->assertInputContains('index.php', 'rand(');
     $result->assertOutputContains($expected);
     $text = trim($result->getCrawler()->filter('h3 span')->text());
     if (!is_numeric($text)) {
         throw new GradingException(sprintf('Are you printing the random number inside the span tag? I see "%s"', $text));
     }
     if ($text > 200 || $text < 100) {
         throw new GradingException(sprintf('Make sure the rand() function only returns numbers between 100 and 200', $text));
     }
 }
 public function grade(CodingExecutionResult $result)
 {
     $result->assertInputContains('new_toy.php', '$_SERVER');
     $result->assertInputContains('new_toy.php', 'HTTP_USER_AGENT');
     $result->assertOutputContains('Mozilla/5.0 (iPad; U; CPU OS 3_2_1 like Mac OS X; en-us) AppleWebKit/531.21.10');
 }
 public function grade(CodingExecutionResult $result)
 {
     $result->assertInputContains('layout/header.php', '<html>');
     $result->assertInputContains('layout/footer.php', '</html>');
     $result->assertInputContains('index.php', '$airpupTagLine =', 'Keep the `$airpupTagLine = ...` code inside `index.php`: that\'s code that is used for just *this* page, and shouldn\'t be in the header');
     $result->assertInputContains('index.php', 'require', 'Don\'t forget to require the `header.php` and `footer.php` files in `index.php` so that it still has the nice layout');
     $result->assertOutputContains('<html>', 'Don\'t forget to require the `header.php` file in `aboutUs.php` so that it has the nice layout');
     $result->assertOutputContains('</html>', 'Don\'t forget to require the `footer.php` file in `aboutUs.php` so that it has the nice layout');
 }
 public function grade(CodingExecutionResult $result)
 {
     $result->assertInputContains('index.php', 'var_dump(');
     $result->assertOutputContains('Kitty', 'Tiger', 'Jay');
 }
 public function grade(CodingExecutionResult $result)
 {
     $result->assertInputContains('new_toy.php', 'json_encode', 'Use `json_encode()` in `new_toy.php` to encode the toys array before saving it');
     $result->assertInputContains('new_toy.php', 'file_put_contents', 'Use `file_put_contents()` in `new_toy.php` to save the new JSON string');
     $result->assertInputContains('new_toy.php', 'var_dump', '`var_dump()` the file contents of `toys.json` after saving the new toy');
     $result->assertInputContains('new_toy.php', 'get_great_pet_toys', 'Call `get_great_pet_toys()` first to get the existing toys');
     $result->assertOutputContains('Bacon Bone', 'I don\'t see `Bacon Bone` in `toys.json` - double-check that you\'re keeping the original pets, not replacing them entirely.');
     $result->assertOutputContains('Fluffy Pig Stuffed Animal', 'I don\'t see the new "Fluffy Pig" toy in `toys.json`. Are you adding it to the toys array before calling `json_encode()` and saving the file?');
 }