public function grade(CodingExecutionResult $result)
 {
     $result->assertInputContains('index.php', 'if');
     $result->assertElementContains('h4', 'Yellow');
     $result->assertElementContains('h4', 'Multiple Colors');
     $result->assertElementContains('h4', 'no color');
 }
 public function grade(CodingExecutionResult $result)
 {
     $result->assertInputContains('index.php', 'if');
     $result->assertElementContains('h4', 'Surprise Color');
     $result->assertElementContains('h4', 'Yellow', 'The Tennis ball is printing as `Surprise Color!`, but it *should* be `Yellow`. There\'s a more subtle mistake in the first part of the `if` statement...');
     $result->assertElementContains('h4', 'no color');
 }
 public function grade(CodingExecutionResult $result)
 {
     $result->assertElementContains('h3', 'Bacon Bone');
     $result->assertElementContains('h3', 'Tennis Ball');
     $result->assertElementContains('h4', 'Bacon-colored');
     $result->assertElementContains('h4', 'Yellow');
 }
 public function grade(CodingExecutionResult $result)
 {
     $result->assertInputContains('index.php', 'file_get_contents');
     $result->assertInputContains('index.php', 'json_decode');
     $result->assertElementContains('h3', 'Bacon Bone');
     $result->assertElementContains('h4', 'Bacon-colored');
 }
 public function grade(CodingExecutionResult $result)
 {
     $result->assertFunctionExists('get_great_pet_toys');
     $result->assertInputContains('index.php', 'get_great_pet_toys(');
     $result->assertElementContains('h4', 'Yellow');
     $result->assertElementContains('h4', 'Multiple Colors');
     $result->assertElementContains('h3', 'Bacon Bone');
 }
 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)
 {
     $result->assertVariableEquals('waggyPig', array('name' => 'Waggy Pig', 'weight' => 10, 'age' => 7, 'bio' => 'Sleepy white fluffy dog'));
     $result->assertElementContains('h2', 'Waggy Pig');
     // help them out - I reversed the order on the elements
     if ($result->getElementText('.age') == '10') {
         throw new GradingException('Careful! Be sure to print the `age` key in the `.age` element and the
             `weight` key in the `.weight` element. You might have them reversed.');
     }
     $result->assertElementContains('.age', 7);
     $result->assertElementContains('.weight', 10);
     $result->assertElementContains('p', 'Sleepy white fluffy dog');
 }
 public function grade(CodingExecutionResult $result)
 {
     $expected = 'Puppy';
     $result->assertOutputContains($expected);
     $result->assertElementContains('h2', $expected);
     $result->assertInputContains('homepage.twig', 'whatIWantForXmas');
 }
 public function grade(CodingExecutionResult $result)
 {
     $result->assertFunctionExists('get_great_pet_toys');
     $result->assertInputContains('lib/functions.php', 'get_great_pet_toys(');
     $result->assertInputContains('index.php', 'require');
     $result->assertElementContains('h3', 'Bacon Bone');
 }
 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)
 {
     $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)
 {
     $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)
 {
     $result->assertInputContains('index.php', 'file_put_contents');
     $result->assertInputContains('index.php', 'doglife.txt');
     $result->assertInputContains('index.php', 'Dogs rule!');
     $result->assertInputContains('index.php', 'file_get_contents');
     $result->assertElementContains('h2', 'Dogs rule!');
 }
 public function grade(CodingExecutionResult $result)
 {
     $result->assertInputContains('index.php', 'foreach');
     $result->assertElementContains('h3', 'Kitty');
     $result->assertElementContains('h3', 'Tiger');
     $result->assertElementContains('h3', 'Jay');
     $buttonCount = substr_count($result->getOutput(), '<button>');
     if ($buttonCount == 0) {
         throw new GradingException('Don\'t forget to add a `<button>Schedule me</button>` inside the `foreach` for each walker!');
     }
     if ($buttonCount == 1) {
         throw new GradingException('I only see 1 `<button>` - make sure to include this *inside* the `foreach` loop so that 3 are printed');
     }
     if ($buttonCount != 3) {
         throw new GradingException('There should be 3 `<button>` element exactly');
     }
 }
 public function grade(CodingExecutionResult $result)
 {
     $result->assertInputContains('index.php', "\$pets[2]['bio']");
     $result->assertElementContains('h1', 'Breakfast is my favorite!');
 }
 public function grade(CodingExecutionResult $result)
 {
     $result->assertVariableEquals('waggyPig[breed]', 'bichon');
     $result->assertInputContains('index.php', '$waggyPig[', 'Add the `breed` key *after* the `$waggyPig` variable is created using the `[\'breed\']` syntax');
     $result->assertElementContains('.breed', 'bichon');
 }
 public function grade(CodingExecutionResult $result)
 {
     $result->assertInputContains('index.php', 'count');
     $result->assertElementContains('h4', 3, 'I don\'t see the number 3 inside the `<h4>` tag. Are you printing the `count()` there?');
 }