Yaffs site version 1.1
[yaffs-website] / vendor / gabordemooij / redbean / testing / RedUNIT / Pretest.php
diff --git a/vendor/gabordemooij/redbean/testing/RedUNIT/Pretest.php b/vendor/gabordemooij/redbean/testing/RedUNIT/Pretest.php
new file mode 100644 (file)
index 0000000..ff88f00
--- /dev/null
@@ -0,0 +1,32 @@
+<?php
+
+/**
+ * Pretest
+ *
+ * These tests will run before the configuration takes place
+ * in the unit test suite (mostly error handling tests).
+ *
+ * @file    RedUNIT/Pretest.php
+ * @desc    Test scripts that run before configuration
+ * @author  Gabor de Mooij and the RedBeanPHP Community
+ * @license New BSD/GPLv2
+ *
+ * (c) G.J.G.T. (Gabor) de Mooij and the RedBeanPHP Community.
+ * This source file is subject to the New BSD/GPLv2 License that is bundled
+ * with this source code in the file license.txt.
+ */
+
+testpack('Running pre-tests. (before config).');
+
+try {
+       R::debug( TRUE );
+       fail();
+} catch( Exception $e ) {
+       pass();
+}
+
+asrt( R::testConnection(), FALSE);
+
+R::addDatabase( 'broken', 'mysql:host=nowhere', 'defunct', 'void' );
+R::selectDatabase( 'broken' );
+asrt( R::testConnection(), FALSE );