<?php
/*
 * Copyright (c) 2012, webvariants GbR, http://www.webvariants.de
 *
 * This file is released under the terms of the MIT license. You can find the
 * complete text in the attached LICENSE file or online at:
 *
 * http://www.opensource.org/licenses/mit-license.php
 */

$here      = dirname(__FILE__);
$sallyRoot = realpath(__DIR__.'/../../../../');

// set our own environment
define('SLY_ADDONFOLDER',   $sallyRoot.'/sally/addons');
define('SLY_DEVELOPFOLDER', $sallyRoot.'/develop');
define('SLY_MEDIAFOLDER',   $sallyRoot.'/data/mediapool');

// bootstrap the tests
require $sallyRoot.'/sally/tests/bootstrap.php';

// make tests autoloadable
$tables = array(
	'article'       => true,
	'article_slice' => false,
	'clang'         => true,
	'file'          => false,
	'file_category' => false,
	'slice'         => false,
	'slice_value'   => false,
	'user'          => true,
	'wv24_urls'     => false,
	'wv8_values'    => true
);

$dump = array();
$db   = sly_DB_Persistence::getInstance();

foreach ($tables as $table => $withContent) {
	print "sly_$table...";

	if (!$withContent) {
		$dump["sly_$table"] = array();
	}
	else {
		$db->select($table, '*');
		$dump["sly_$table"] = $db->all();
	}

	print "done.\n";
}

file_put_contents(__DIR__.'/datasets/dump.yml', sfYaml::dump($dump, 2));
