Best Atoum code snippet using runner.version
MigrationRunnerTest.php
Source:MigrationRunnerTest.php
...52 $runner = new MigrationRunner($this->config);53 $tableMaker = $this->getPrivateMethodInvoker($runner, 'ensureTable');54 $tableMaker();55 $history = [56 'version' => 'abc123',57 'name' => 'changesomething',58 'group' => 'default',59 'namespace' => 'App',60 'time' => time(),61 ];62 $this->hasInDatabase('migrations', $history);63 $this->assertEquals($history, $runner->getHistory()[0]);64 }65 public function testGetHistoryReturnsEmptyArrayWithNoResults()66 {67 $runner = new MigrationRunner($this->config);68 $tableMaker = $this->getPrivateMethodInvoker($runner, 'ensureTable');69 $tableMaker();70 $this->assertEquals([], $runner->getHistory());71 }72 public function testGetMigrationNumber()73 {74 $runner = new MigrationRunner($this->config);75 $method = $this->getPrivateMethodInvoker($runner, 'getMigrationNumber');76 $this->assertEquals('0123456', $method('0123456_Foo'));77 }78 public function testGetMigrationNumberReturnsZeroIfNoneFound()79 {80 $runner = new MigrationRunner($this->config);81 $method = $this->getPrivateMethodInvoker($runner, 'getMigrationNumber');82 $this->assertEquals('0', $method('Foo'));83 }84 public function testSetSilentStoresValue()85 {86 $runner = new MigrationRunner($this->config);87 $runner->setSilent(true);88 $this->assertTrue($this->getPrivateProperty($runner, 'silent'));89 $runner->setSilent(false);90 $this->assertFalse($this->getPrivateProperty($runner, 'silent'));91 }92 public function testSetNameStoresValue()93 {94 $runner = new MigrationRunner($this->config);95 $runner->setName('foo');96 $this->assertEquals('foo', $this->getPrivateProperty($runner, 'name'));97 }98 public function testSetGroupStoresValue()99 {100 $runner = new MigrationRunner($this->config);101 $runner->setGroup('foo');102 $this->assertEquals('foo', $this->getPrivateProperty($runner, 'group'));103 }104 public function testSetNamespaceStoresValue()105 {106 $runner = new MigrationRunner($this->config);107 $runner->setNamespace('foo');108 $this->assertEquals('foo', $this->getPrivateProperty($runner, 'namespace'));109 }110 public function testFindMigrationsReturnsEmptyArrayWithNoneFound()111 {112 $config = $this->config;113 $config->type = 'timestamp';114 $runner = new MigrationRunner($config);115 $runner->setPath($this->start);116 $this->assertEquals([], $runner->findMigrations());117 }118 public function testFindMigrationsSuccessTimestamp()119 {120 $config = $this->config;121 $config->type = 'timestamp';122 $runner = new MigrationRunner($config);123 $runner = $runner->setPath($this->start);124 vfsStream::newFile('20180124102301_some_migration.php')->at($this->root);125 vfsStream::newFile('20180124082302_another_migration.php')->at($this->root); // should be first126 vfsStream::newFile('20180124082303_another_migration.py')->at($this->root); // shouldn't be included127 vfsStream::newFile('201801240823_another_migration.py')->at($this->root); // shouldn't be included128 $mig1 = (object)[129 'name' => 'some_migration',130 'path' => 'vfs://root//20180124102301_some_migration.php',131 'version' => '20180124102301',132 ];133 $mig2 = (object)[134 'name' => 'another_migration',135 'path' => 'vfs://root//20180124082302_another_migration.php',136 'version' => '20180124082302',137 ];138 $migrations = $runner->findMigrations();139 $this->assertCount(2, $migrations);140 $this->assertEquals($mig2, array_shift($migrations));141 $this->assertEquals($mig1, array_shift($migrations));142 }143 public function testFindMigrationsSuccessOrder()144 {145 $config = $this->config;146 $config->type = 'sequential';147 $runner = new MigrationRunner($config);148 $runner = $runner->setPath($this->start);149 vfsStream::newFile('002_some_migration.php')->at($this->root);150 vfsStream::newFile('001_another_migration.php')->at($this->root); // should be first151 vfsStream::newFile('003_another_migration.py')->at($this->root); // shouldn't be included152 vfsStream::newFile('004_another_migration.py')->at($this->root); // shouldn't be included153 $mig1 = (object)[154 'name' => 'some_migration',155 'path' => 'vfs://root//002_some_migration.php',156 'version' => '002',157 ];158 $mig2 = (object)[159 'name' => 'another_migration',160 'path' => 'vfs://root//001_another_migration.php',161 'version' => '001',162 ];163 $migrations = $runner->findMigrations();164 $this->assertEquals($mig2, array_shift($migrations));165 $this->assertEquals($mig1, array_shift($migrations));166 }167 /**168 * @expectedException \CodeIgniter\Exceptions\ConfigException169 * @expectedExceptionMessage Migrations have been loaded but are disabled or setup incorrectly.170 */171 public function testMigrationThrowsDisabledException()172 {173 $config = $this->config;174 $config->type = 'sequential';175 $config->enabled = false;176 $runner = new MigrationRunner($config);177 $runner->setSilent(false);178 $runner = $runner->setPath($this->start);179 vfsStream::copyFromFileSystem(180 TESTPATH . '_support/Database/SupportMigrations',181 $this->root182 );183 $this->expectException(ConfigException::class);184 $this->expectExceptionMessage('Migrations have been loaded but are disabled or setup incorrectly.');185 $runner->version(1);186 }187 /**188 * @expectedException \RuntimeException189 * @expectedExceptionMessage There is a gap in the migration sequence near version number: 002190 */191 public function testVersionThrowsMigrationGapException()192 {193 $config = $this->config;194 $config->type = 'sequential';195 $runner = new MigrationRunner($config);196 $runner = $runner->setPath($this->start);197 vfsStream::newFile('002_some_migration.php')->at($this->root);198 $version = $runner->version(0);199 $this->assertFalse($version);200 }201 public function testVersionReturnsFalseWhenNothingToDo()202 {203 $config = $this->config;204 $config->type = 'sequential';205 $runner = new MigrationRunner($config);206 $runner = $runner->setPath($this->start);207 vfsStream::newFile('001_some_migration.php')->at($this->root);208 $version = $runner->version(0);209 $this->assertFalse($version);210 }211 /**212 * @expectedException \RuntimeException213 * @expectedExceptionMessage The migration class "App\Database\Migrations\Migration_some_migration" could not be found.214 */215 public function testVersionWithNoClassInFile()216 {217 $config = $this->config;218 $config->type = 'sequential';219 $runner = new MigrationRunner($config);220 $runner->setSilent(false);221 $runner = $runner->setPath($this->start);222 vfsStream::newFile('001_some_migration.php')->at($this->root);223 $version = $runner->version(1);224 $this->assertFalse($version);225 }226 public function testVersionReturnsUpDownSuccess()227 {228 $config = $this->config;229 $config->type = 'sequential';230 $runner = new MigrationRunner($config);231 $runner->setSilent(false);232 $runner = $runner->setPath($this->start);233 vfsStream::copyFromFileSystem(234 TESTPATH . '_support/Database/SupportMigrations',235 $this->root236 );237 $version = $runner->version(1);238 $this->assertEquals('001', $version);239 $this->seeInDatabase('foo', ['key' => 'foobar']);240 $version = $runner->version(0);241 $this->assertEquals('000', $version);242 $this->assertFalse(db_connect()->tableExists('foo'));243 }244 public function testLatestSuccess()245 {246 $config = $this->config;247 $config->type = 'sequential';248 $runner = new MigrationRunner($config);249 $runner->setSilent(false);250 $runner = $runner->setPath($this->start);251 vfsStream::copyFromFileSystem(252 TESTPATH . '_support/Database/SupportMigrations',253 $this->root254 );255 $version = $runner->latest();256 $this->assertEquals('001', $version);257 $this->assertTrue(db_connect()->tableExists('foo'));258 }259 public function testVersionReturnsDownSuccess()260 {261 $config = $this->config;262 $config->type = 'sequential';263 $runner = new MigrationRunner($config);264 $runner->setSilent(false);265 $runner = $runner->setPath($this->start);266 vfsStream::copyFromFileSystem(267 TESTPATH . '_support/Database/SupportMigrations',268 $this->root269 );270 $version = $runner->version(0);271 $this->assertEquals('000', $version);272 $this->assertFalse(db_connect()->tableExists('foo'));273 }274 public function testCurrentSuccess()275 {276 $config = $this->config;277 $config->type = 'sequential';278 $config->currentVersion = 1;279 $runner = new MigrationRunner($config);280 $runner->setSilent(false);281 $runner = $runner->setPath($this->start);282 vfsStream::copyFromFileSystem(283 TESTPATH . '_support/Database/SupportMigrations',284 $this->root285 );286 $version = $runner->current();287 $this->assertEquals('001', $version);288 $this->assertTrue(db_connect()->tableExists('foo'));289 }290}...
version
Using AI Code Generation
1require_once 'runner.php';2$runner = new Runner();3echo $runner->version();4require_once 'runner.php';5$runner = new Runner();6echo $runner->version();7class Runner {8 public function version() {9 return '1.0.0';10 }11}12require_once 'Runner.php';13$runner = new Runner();14echo $runner->version();15require_once 'Runner.php';16$runner = new Runner();17echo $runner->version();
version
Using AI Code Generation
1require_once 'runner.php';2$runner = new runner();3$runner->version();4require_once 'runner.php';5$runner = new runner();6$runner->run();7require_once 'runner.php';8$runner = new runner();9$runner->run();10require_once 'runner.php';11$runner = new runner();12$runner->run();13require_once 'runner.php';14$runner = new runner();15$runner->run();16require_once 'runner.php';17$runner = new runner();18$runner->run();19require_once 'runner.php';20$runner = new runner();21$runner->run();22require_once 'runner.php';23$runner = new runner();24$runner->run();25require_once 'runner.php';26$runner = new runner();27$runner->run();28require_once 'runner.php';29$runner = new runner();30$runner->run();31require_once 'runner.php';32$runner = new runner();33$runner->run();34require_once 'runner.php';35$runner = new runner();36$runner->run();37require_once 'runner.php';38$runner = new runner();39$runner->run();
version
Using AI Code Generation
1$runner = new Runner();2$runner->version();3$runner->run();4$runner->run();5$runner = new Runner();6$runner->version();7$runner->run();8$runner->run();9$runner = new Runner();10$runner->version();11$runner->run();12$runner->run();13$runner = new Runner();14$runner->version();15$runner->run();16$runner->run();17$runner = new Runner();18$runner->version();19$runner->run();20$runner->run();21$runner = new Runner();22$runner->version();23$runner->run();24$runner->run();25$runner = new Runner();26$runner->version();27$runner->run();28$runner->run();29$runner = new Runner();30$runner->version();31$runner->run();32$runner->run();33$runner = new Runner();34$runner->version();35$runner->run();
version
Using AI Code Generation
1$runner->version();2$runner->run();3$runner->version();4$runner->run();5$runner->version();6$runner->run();7$runner->version();8$runner->run();9$runner->version();10$runner->run();11$runner->version();12$runner->run();13$runner->version();14$runner->run();15$runner->version();16$runner->run();17$runner->version();18$runner->run();19$runner->version();
version
Using AI Code Generation
1$runner = new Runner();2$runner->version();3PHP 5.3.8-1ubuntu3.3 with Suhosin-Patch (cli) (built: Dec 6 2011 15:51:18) Copyright (c) 1997-2011 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2011 Zend Technologies4echo phpversion();5echo getcwd();6echo filemtime($_SERVER['SCRIPT_FILENAME']);7echo $_SERVER['SCRIPT_NAME'];8echo $_SERVER['SERVER_NAME'];9echo getenv('HOME');10echo gethostname();11echo $_SERVER['HTTP_ACCEPT_LANGUAGE'];12en-US,en;q=0.5
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Execute automation tests with version on a cloud-based Grid of 3000+ real browsers and operating systems for both web and mobile applications.
Test now for FreeGet 100 minutes of automation test minutes FREE!!