/** * Setup database. */ protected function setUp() { Bootstrap::getServiceManager(); $conn = $this->getConnection(); $conn->getConnection()->query("set foreign_key_checks=0"); parent::setUp(); $conn->getConnection()->query("set foreign_key_checks=1"); }
/** * */ protected function setUp() { $serviceManager = Bootstrap::getServiceManager(); $this->config = $serviceManager->get('Config'); $conn = $this->getConnection(); $conn->getConnection()->query("set foreign_key_checks=0"); parent::setUp(); $conn->getConnection()->query("set foreign_key_checks=1"); $service = new Event(); $service->setDataSource(self::$pdo); $this->service = $service; }
protected function setUp() { $serviceManager = Bootstrap::getServiceManager(); $this->controller = new IndexController(); $this->request = new Request(); $this->routeMatch = new RouteMatch(array('controller' => 'index')); $this->event = new MvcEvent(); $config = $serviceManager->get('Config'); $routerConfig = isset($config['router']) ? $config['router'] : array(); $router = HttpRouter::factory($routerConfig); $this->event->setRouter($router); $this->event->setRouteMatch($this->routeMatch); $this->controller->setEvent($this->event); $this->controller->setServiceLocator($serviceManager); }
/** * Sets up the fixture, for example, open a network connection. * This method is called before a test is executed. * Performs operation returned by getSetUpOperation(). */ protected function setUp() { $serviceManager = Bootstrap::getServiceManager(); $this->controller = new ArticleController(); $this->request = new Request(); $this->routeMatch = new RouteMatch(array('controller' => 'index')); $this->event = new MvcEvent(); $this->config = $serviceManager->get('Config'); $routerConfig = isset($this->config['router']) ? $this->config['router'] : array(); $router = HttpRouter::factory($routerConfig); $this->event->setRouter($router); $this->event->setRouteMatch($this->routeMatch); $this->controller->setEvent($this->event); $this->controller->setServiceLocator($serviceManager); $conn = $this->getConnection(); $conn->getConnection()->query("set foreign_key_checks=0"); parent::setUp(); $conn->getConnection()->query("set foreign_key_checks=1"); }
$table = new PHPUnit_Extensions_Database_DataSet_DefaultTable($metaData); foreach ($rows as $row) { $table->addRow($row); } $this->tables[$tableName] = $table; } } protected function createIterator($reverse = false) { return new PHPUnit_Extensions_Database_DataSet_DefaultTableIterator($this->tables, $reverse); } public function getTable($tableName) { if (!isset($this->tables[$tableName])) { throw new InvalidArgumentException("{$tableName} is not a table in the current database."); } return $this->tables[$tableName]; } } class PDOMock extends \PDO { public function __construct() { } public function prepare($statement, $driver_options = null) { throw new \PDOException(); } } Bootstrap::init();