public static function TestIsArray() { Framework\Test::add(function () { $books = \Book::getAllForApi(); return is_array($books); }, "Book class initialize", "Returns an array"); }
public static function configuration() { Framework\Test::add(function () { $configuration = new Framework\Configuration(); return $configuration instanceof Framework\Configuration; }, "Configuration instantiates in uninitialized state", "Configuration"); }
public static function databaseInstantiation() { Framework\Test::add(function () { $database = new Framework\Database(); return $database instanceof Framework\Database; }, "Database instantiates in uninitialized state", "Database"); }
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"); }
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"); }
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"); }
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"); }
public function tests() { $this->setCustomLayoutView('test'); \Framework\Test::start(); $this->actionView->set('data', \Framework\Test::run()); }
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"); }