Ejemplo n.º 1
0
 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`.');
 }
Ejemplo n.º 2
0
 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');
 }
Ejemplo n.º 3
0
 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');
 }
Ejemplo n.º 4
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');
 }
Ejemplo n.º 5
0
 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.');
 }
Ejemplo n.º 6
0
 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.');
 }
Ejemplo n.º 7
0
 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.');
 }
 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!');
 }
Ejemplo n.º 9
0
 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');
 }
Ejemplo n.º 10
0
 public function grade(CodingExecutionResult $result)
 {
     $htmlGrader = new HtmlOutputGradingTool($result);
     $htmlGrader->assertOutputContains('due to: little wings');
 }
Ejemplo n.º 11
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);
     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?');
 }
Ejemplo n.º 13
0
 public function grade(CodingExecutionResult $result)
 {
     $htmlGrader = new HtmlOutputGradingTool($result);
     $htmlGrader->assertOutputContains('The fall products are coming soon!');
 }