/** * Copy and paste testDB stub over actual testDB * * Called frequently during testing to quickly reset * the databases values. This prevents changes to the testDB * during one test affecting the outcome of another test. * * @codeCoverageIgnore */ public function refreshDB() { //app()['config']->set('database.default', 'sqlite'); //app()['config']->set('database.connections.sqlite.database', 'database/testing/database.sqlite'); $disk = OhioHelper::baseDisk(); $path = 'database/testing'; # create stub DB for unit testing $disk->delete("{$path}/stub.sqlite"); $disk->copy("{$path}/database.sqlite", "{$path}/stub.sqlite"); }
/** * @covers \Ohio\Core\Base\Helper\OhioHelper::__toString * @covers \Ohio\Core\Base\Helper\OhioHelper::baseDisk * @covers \Ohio\Core\Base\Helper\OhioHelper::uses */ public function test() { $helper = new OhioHelper(); # __toString $this->assertTrue(is_string($helper->__toString())); # baseDisk $this->assertInstanceOf(Filesystem::class, $helper->baseDisk()); # uses $this->assertTrue($helper->uses('core')); $this->assertTrue($helper->uses('Ohio\\Core\\Base\\OhioCoreServiceProvider')); $this->assertFalse($helper->uses('tacos')); }
/** * @return \Illuminate\Contracts\Filesystem\Filesystem */ public function disk() { return $this->disk = $this->disk ?: OhioHelper::baseDisk(); }