Ejemplo n.º 1
0
 /**
  * @test
  */
 public function TestAddHelpIsOnlyAddedOnce()
 {
     /**
      * test to make sure addHelp text is only added once to a message
      */
     $message = new Messages();
     $message->addHelp();
     // add once
     $countAfterFirst = count($message->get());
     $message->addHelp();
     // add twice
     $countAfterSecond = count($message->get());
     // first and second count should be exactly the same
     $this->assertEquals($countAfterFirst, $countAfterSecond);
 }
Ejemplo n.º 2
0
<?php

/**
 * @author Ryan Spencer <*****@*****.**>
 */
require 'src/autoload.php';
use App\Lib\Csv;
use App\Lib\Json;
use App\Lib\Args;
use App\Lib\Messages;
date_default_timezone_set('Australia/Sydney');
$message = new Messages();
if (isset($argv)) {
    $arguments = new Args($argv);
    if ($arguments->count() == 2) {
        $ingredients = new Csv($arguments->get(0));
        // check to see if there was any ingredients imported
        if (!$ingredients->count()) {
            $error = $ingredients->hasError();
            if ($error["error"]) {
                $message->add($error["message"]);
            } else {
                // order takeout
                $message->add("All ingredients are past their used by date, Order Takeout!");
            }
        } else {
            // import recipes
            $recipes = new Json($arguments->get(1));
            if (!$recipes->count()) {
                $error = $recipes->hasError();
                if ($error["error"]) {