Exemple #1
0
 public static function TestIsArray()
 {
     Framework\Test::add(function () {
         $books = \Book::getAllForApi();
         return is_array($books);
     }, "Book class initialize", "Returns an array");
 }
Exemple #2
0
 public static function configuration()
 {
     Framework\Test::add(function () {
         $configuration = new Framework\Configuration();
         return $configuration instanceof Framework\Configuration;
     }, "Configuration instantiates in uninitialized state", "Configuration");
 }
Exemple #3
0
 public static function databaseInstantiation()
 {
     Framework\Test::add(function () {
         $database = new Framework\Database();
         return $database instanceof Framework\Database;
     }, "Database instantiates in uninitialized state", "Database");
 }
Exemple #4
0
 public static function parseIni()
 {
     Framework\Test::add(function () {
         $configuration = new Framework\Configuration(array("type" => "ini"));
         $configuration = $configuration->initialize();
         $parsed = $configuration->parse("application/configuration/smooth");
         return $parsed->config->first == "hello" && $parsed->config->second->second == "bar";
     }, "Configuration\\Driver\\Ini parses configuration files", "Configuration\\Driver\\Ini");
 }
Exemple #5
0
 public static function delete()
 {
     $database = Framework\Registry::get('database');
     Framework\Test::add(function () use($database) {
         $example = new Model\Example(array("id" => 2));
         $example->delete();
         return Model\Example::count() == 1;
     }, "Model deletes rows", "Model");
 }
Exemple #6
0
 public static function deleteRows()
 {
     $options = self::$options;
     Framework\Test::add(function () use($options) {
         $database = new Framework\Database($options);
         $database = $database->initialize();
         $database = $database->connect();
         $database->query()->from("tests")->delete();
         return $database->query()->from("tests")->count() == 0;
     }, "Database\\Query\\Mysql can delete rows", "Database\\Query\\Mysql");
 }
Exemple #7
0
 public static function affectedRows()
 {
     $options = self::$options;
     Framework\Test::add(function () use($options) {
         $database = new Framework\Database($options);
         $database = $database->initialize();
         $database = $database->connect();
         $database->execute("\n                        UPDATE `tests` SET `number` = 1338;\n                    ");
         return $database->affectedRows;
     }, "Database\\Connector\\Mysql returns affected rows", "Database\\Connector\\Mysql");
 }
Exemple #8
0
 public function tests()
 {
     $this->setCustomLayoutView('test');
     \Framework\Test::start();
     $this->actionView->set('data', \Framework\Test::run());
 }
Exemple #9
0
 public static function MemcachedEraseValues()
 {
     Framework\Test::add(function () {
         $cache = new Framework\Cache(array("type" => "memcached"));
         $cache = $cache->initialize();
         $cache = $cache->connect();
         $cache = $cache->set("hello", "world");
         $cache = $cache->erase("hello");
         return $cache->get("hello") == null && $cache instanceof Framework\Cache\Driver\Memcached;
     }, "Cache\\Driver\\Memcached erases values and returns self", "Cache\\Driver\\Memcached");
 }