Пример #1
0
 /**
  * tearDown method
  *
  * @return void
  */
 public function tearDown()
 {
     parent::tearDown();
     Plugin::unload();
     ConnectionManager::drop('test_variant');
     ConnectionManager::dropAlias('other_name');
 }
 public function testInvalidDB()
 {
     $this->setExpectedException('Chris48s\\Searchable\\Exception\\SearchableFatalException');
     //set up a SQLite DB connection - SQLite is not supported
     ConnectionManager::config('invalid', ['url' => 'sqlite:///:memory:', 'timezone' => 'UTC']);
     $conn = ConnectionManager::get('invalid');
     //create a table in SQLite
     $conn->query("CREATE TABLE `Foo` (\n            `id` int(11) NOT NULL,\n            `textcol` VARCHAR(255),\n            PRIMARY KEY (`id`)\n        );");
     $table = TableRegistry::get('Foo', ['connection' => $conn]);
     $table->addBehavior('Chris48s/Searchable.Searchable');
     //tidy up
     ConnectionManager::dropAlias('invalid');
 }
 public function testInvalidDB()
 {
     $this->setExpectedException('Chris48s\\GeoDistance\\Exception\\GeoDistanceFatalException');
     //set up a SQLite DB connection - SQLite is not supported
     ConnectionManager::config('invalid', ['url' => 'sqlite:///:memory:', 'timezone' => 'UTC']);
     $conn = ConnectionManager::get('invalid');
     //create a table in SQLite
     $conn->query("CREATE TABLE `Foo` (\n            `id` int(11) NOT NULL,\n            `lat` float,\n            `lng` float,\n            PRIMARY KEY (`id`)\n        );");
     $table = TableRegistry::get('Foo', ['connection' => $conn]);
     $table->addBehavior('Chris48s/GeoDistance.GeoDistance', ['latitudeColumn' => 'lat', 'longitudeColumn' => 'lng']);
     //tidy up
     ConnectionManager::dropAlias('invalid');
 }