public function grade(CodingExecutionResult $result)
 {
     $normalGrader = new PhpGradingTool($result);
     $htmlGrader = new HtmlOutputGradingTool($result);
     $normalGrader->assertInputContains('fallCollection.twig', 'fallCollectionPromoDescription', 'I don\'t see you printing the unknown variable yet...');
     $htmlGrader->assertOutputContains('Still wearing your summer swim shorts');
 }
 public function grade(CodingExecutionResult $result)
 {
     $normalGrader = new PhpGradingTool($result);
     $htmlGrader = new HtmlOutputGradingTool($result);
     $normalGrader->assertInputContains('fallCollection.twig', 'collectionTitle');
     $htmlGrader->assertElementContains('h1', 'Fall in love and look your best in the snow.');
 }
 public function grade(CodingExecutionResult $result)
 {
     $normalGrader = new PhpGradingTool($result);
     $htmlGrader = new HtmlOutputGradingTool($result);
     $htmlGrader->assertOutputContains('<strong>', 'The `<strong>` tag still looks escaped - how can you make it raw?');
     $normalGrader->assertInputContains('singleItem.twig', 'raw', 'Use the `raw` filter to *not* escape HTML tags');
 }
 public function grade(CodingExecutionResult $result)
 {
     $normalGrader = new PhpGradingTool($result);
     $htmlGrader = new HtmlOutputGradingTool($result);
     $normalGrader->assertInputContains('layout.twig', 'block(', 'Use the `block(\'sidebar\') function to determine if the child template has any sidebar content');
     $htmlGrader->assertOutputDoesNotContain('col-xs-3', 'Make sure the `.col-xs-3` element does not print at all, since there is no sidebar on this page.');
     $htmlGrader->assertOutputContains('col-xs-12', 'Change the main content div\'s class to be `col-xs-9` when there is no sidebar content.');
 }
 public function grade(CodingExecutionResult $result)
 {
     $normalGrader = new PhpGradingTool($result);
     $htmlGrader = new HtmlOutputGradingTool($result);
     $htmlGrader->assertElementContains('.stock-status', 'Out of Stock');
     $htmlGrader->assertElementContains('.stock-status', '62');
     $normalGrader->assertInputDoesNotContain('fallCollection.twig', '{% if', 'Remove the `{% if` statement and replace it with a single line that does the same thing');
 }
Beispiel #6
0
 public function grade(CodingExecutionResult $result)
 {
     $normalGrader = new PhpGradingTool($result);
     $htmlGrader = new HtmlOutputGradingTool($result);
     $normalGrader->assertInputContains('fallCollection.twig', 'saleStartsAt');
     $normalGrader->assertInputContains('fallCollection.twig', 'F jS', 'Make sure you use the `F jS` (e.g. January 5th) format for the date');
     $htmlGrader->assertElementContains('h3', $this->getSaleStartsAt()->format('F jS'));
 }
 public function grade(CodingExecutionResult $result)
 {
     $normalGrader = new PhpGradingTool($result);
     $htmlGrader = new HtmlOutputGradingTool($result);
     $htmlGrader->assertOutputDoesNotContain('The Black and Tan Trouser');
     $htmlGrader->assertOutputContains('Starfish Halloween Costume');
     $normalGrader->assertInputDoesNotContain('fallCollection.twig', '{% if', 'Hide the products with zero quantity, but without a new `{% if ...` statement: add an "if" part to the `{% for ...` tag.');
 }
Beispiel #8
0
 public function grade(CodingExecutionResult $result)
 {
     $normalGrader = new PhpGradingTool($result);
     $htmlGrader = new HtmlOutputGradingTool($result);
     $htmlGrader->assertOutputContains('We promise, 1 more pair of pants is coming very soon!');
     $normalGrader->assertInputContains('fallCollection.twig', 'length', 'Use the `length` filter to count the products');
     $normalGrader->assertInputContains('fallCollection.twig', 'is odd', 'Use the `is odd` to see if there are an odd number of products');
 }
 public function grade(CodingExecutionResult $result)
 {
     $normalGrader = new PhpGradingTool($result);
     $htmlGrader = new HtmlOutputGradingTool($result);
     $htmlGrader->assertOutputContains('Winter is coming! Get your pants!');
     $htmlGrader->assertElementContains('footer', 'Winter is coming! Get your pants!', 'It looks like the `<footer>` HTML tag is gone. Print the text inside of this tag');
     $normalGrader->assertInputDoesNotContain('fallCollection.twig', '<footer>', 'You don\'t need to have the `<footer>` tag inside of `fallCollection.twig`. Instead, only put this `layout.twig`, and make your block only override the contents *inside* of it');
     $normalGrader->assertInputContains('layout.twig', 'You\'re hip, you\'re cool, you\'re a penguin!', 'Oh no! The original caption - `You\'re hip, you\'re cool, you\'re a penguin!` will now be missing from every other template that does *not* override the block. Make this be the default footer content.');
 }
Beispiel #10
0
 public function grade(CodingExecutionResult $result)
 {
     $normalGrader = new PhpGradingTool($result);
     $htmlGrader = new HtmlOutputGradingTool($result);
     $normalGrader->assertInputContains('fallCollection.twig', '{%', 'Make sure to use the "do" something tag `{%` with the `for` tag');
     $normalGrader->assertInputContains('fallCollection.twig', 'for', 'Use the `for` tag to loop');
     $htmlGrader->assertElementContains('h3', 'The Black and Tan Trouser');
     $htmlGrader->assertElementContains('h3', 'Antarctic Snow Pants (in leopard seal print)');
 }
 public function grade(CodingExecutionResult $result)
 {
     $normalGrader = new PhpGradingTool($result);
     $htmlGrader = new HtmlOutputGradingTool($result);
     $htmlGrader->assertOutputContains('The Black and Tan Trouser', 'Are you printing the product names?');
     $htmlGrader->assertOutputContains(99, 'Are you printing the product prices?');
     $normalGrader->assertInputContains('fallCollection.twig', 'product.name', 'You can just use `product.name` to print the name. Behind the scenes. Twig calls the `getName()` function on `PantsProduct`.');
     $normalGrader->assertInputContains('fallCollection.twig', 'product.price', 'You can just use `product.price` to print the price. Behind the scenes. Twig calls the `getPrice()` function on `PantsProduct`.');
 }
 public function grade(CodingExecutionResult $result)
 {
     $normalGrader = new PhpGradingTool($result);
     $htmlGrader = new HtmlOutputGradingTool($result);
     $normalGrader->assertInputContains('fallCollection.twig', 'random(', 'Are you using the random() function?');
     $normalGrader->assertInputContains('fallCollection.twig', 'upper', 'Don\'t forget to use the `upper` filter to uppercase the colors!');
     $normalGrader->assertInputContains('fallCollection.twig', 'black', 'Use `black` (lowercase) as one of the random colors', true);
     $normalGrader->assertInputContains('fallCollection.twig', 'white', 'Use `black` (lowercase) as one of the random colors', true);
     $normalGrader->assertInputContains('fallCollection.twig', 'green', 'Use `black` (lowercase) as one of the random colors', true);
     if (!$htmlGrader->doesOutputContain('BLACK', true) && !$htmlGrader->doesOutputContain('WHITE', true) && !$htmlGrader->doesOutputContain('GREEN', true)) {
         throw new GradingException('The output does not contain any of the colors BLACK, GREEN or WHITE - are you randomly selecting one of these and uppercasing them?');
     }
 }
 public function grade(CodingExecutionResult $result)
 {
     $normalGrader = new PhpGradingTool($result);
     $htmlGrader = new HtmlOutputGradingTool($result);
     $normalGrader->assertInputContains('fallCollection.twig', 'extends', '`fallCollection.twig` needs to "extend" `layout.twig`');
     $normalGrader->assertInputContains('fallCollection.twig', 'layout.twig', '`fallCollection.twig` needs to "extend" `layout.twig`');
     $normalGrader->assertInputContains('mainCollection.twig', 'extends', '`mainCollection.twig` needs to "extend" `layout.twig`');
     $normalGrader->assertInputContains('mainCollection.twig', 'layout.twig', '`mainCollection.twig` needs to "extend" `layout.twig`');
     $normalGrader->assertInputContains('layout.twig', '<html', 'Put the entire HTML layout into `layout.twig`');
     $normalGrader->assertInputContains('layout.twig', '</html>', 'Put the entire HTML layout into `layout.twig`');
     $normalGrader->assertInputContains('layout.twig', '<header>', 'The `<header>` belongs in `layout.twig` too, since it\'s repeated on both pages');
     $normalGrader->assertInputDoesNotContain('fallCollection.twig', '<html', 'You no longer need the HTML layout (e.g. the `<html>` tag) inside of `fallCollection.twig`');
     $htmlGrader->assertOutputContains('The fall products are coming soon!');
 }
 public function grade(CodingExecutionResult $result)
 {
     $htmlGrader = new HtmlOutputGradingTool($result);
     $deathStar3Class = new \ReflectionClass('\\DeathStarIII');
     if (!$deathStar3Class->isSubclassOf('\\AbstractDeathStar')) {
         throw new GradingException('The `DeathStarIII` class should extend the `AbstractDeathStar` one.');
     }
     $deathStar3 = $result->getDeclaredVariableValue('deathStar3');
     if (!$htmlGrader->doesOutputContain($deathStar3->getDescription())) {
         throw new GradingException('Hmm, did you print the `DeathStarIII` description in `h3` tag?');
     }
 }
 public function grade(CodingExecutionResult $result)
 {
     $htmlGrader = new HtmlOutputGradingTool($result);
     if (!class_exists('\\LaserWeapon')) {
         throw new GradingException('Class `LaserWeapon` could not be found. Did you create it?');
     }
     $laserWeaponClass = new \ReflectionClass('\\LaserWeapon');
     if (!$laserWeaponClass->implementsInterface('\\WeaponInterface')) {
         throw new GradingException('Class `LaserWeapon` should implement the `WeaponInterface` interface.');
     }
     $laserWeapon = $laserWeaponClass->newInstance();
     $htmlGrader->assertOutputContains($laserWeapon->getWeaponRange(), 'Seems you forgot to output the laser weapon range. Did you print the result of the `getWeaponRange()` method?');
 }
 public function grade(CodingExecutionResult $result)
 {
     $normalGrader = new PhpGradingTool($result);
     $htmlGrader = new HtmlOutputGradingTool($result);
     $normalGrader->assertInputContains('macros.twig', 'printSizingChart(', 'I don\'t see the `printSizingChart` macro in `macros.twig`');
     $normalGrader->assertInputContains('macros.twig', 'showXLColumn', 'I don\'t see the `showXLColumn` argument for the `printSizingChart` macro. Add this and use it to hide/show the XL column.');
     $normalGrader->assertInputContains('fallCollection.twig', 'printSizingChart', 'You\'ll need to use the `printSizingChart` macro inside `fallCollection.twig');
     $normalGrader->assertInputContains('mainCollection.twig', 'printSizingChart', 'You\'ll need to use the `printSizingChart` macro inside `mainCollection.twig');
     $normalGrader->assertInputContains('mainCollection.twig', 'import', 'Don\'t forget to `import` `macros.twig` in `mainCollection.twig`.');
     $htmlGrader->assertOutputContains('5-15 lbs');
     $htmlGrader->assertOutputDoesNotContain('61-85 lbs');
 }
 public function grade(CodingExecutionResult $result)
 {
     $htmlGrader = new HtmlOutputGradingTool($result);
     $htmlGrader->assertOutputContains('due to: little wings');
 }
Beispiel #18
0
 public function grade(CodingExecutionResult $result)
 {
     $normalGrader = new PhpGradingTool($result);
     $htmlGrader = new HtmlOutputGradingTool($result);
     $htmlGrader->assertOutputContains('pin-striped full suit');
     $normalGrader->assertInputContains('fallCollection.twig', 'include');
     $normalGrader->assertInputContains('_featuredProduct.twig', 'pin-striped full suit');
     $normalGrader->assertInputDoesNotContain('fallCollection.twig', 'pin-striped full suit', 'Now that you\'re including `_featuredProduct.twig`, you should remove the "pin-striped full suit" text from `fallCollection.twig`');
     $normalGrader->assertInputContains('mainCollection.twig', 'include');
 }
 public function grade(CodingExecutionResult $result)
 {
     $htmlGrader = new HtmlOutputGradingTool($result);
     $htmlGrader->assertOutputContains('The fall products are coming soon!');
 }