/**
  * @test
  * @testdox Creating first widget of given type creates new option
  */
 public function creatingFirstWidgetOfGivenTypeCreatesOption()
 {
     self::$worker->prepare_createWidget();
     $this->commitAsserter->reset();
     self::$worker->createWidget();
     $this->commitAsserter->assertNumCommits(1);
     if (self::$testConfig->end2endTestType === 'selenium' && WpVersionComparer::compare(self::$testConfig->testSite->wpVersion, '4.4-beta1') >= 0) {
         $this->commitAsserter->assertCommitAction('option/edit');
         $this->commitAsserter->assertCommitPath('M', '%vpdb%/options/%VPID%.ini');
     } else {
         $this->commitAsserter->assertCommitAction('option/create');
         $this->commitAsserter->assertCommitPath('A', '%vpdb%/options/%VPID%.ini');
     }
     $this->commitAsserter->assertCountOfAffectedFiles(2);
     $this->commitAsserter->assertCleanWorkingDirectory();
     DBAsserter::assertFilesEqualDatabase();
 }
 protected function isWpVersionLowerThan($version)
 {
     return WpVersionComparer::compare(self::$testConfig->testSite->wpVersion, $version) < 0;
 }
 /**
  * @test
  * @depends cancelDeactivationReturnsToPluginPage
  */
 public function confirmingDeactivationFullyDeactivatesVersionPress()
 {
     $this->byCssSelector('.deactivate a[href*=\'versionpress\']')->click();
     if (WpVersionComparer::compare(TestConfig::createDefaultConfig()->testSite->wpVersion, '4.2-beta1') < 0) {
         $deactivationUrl = 'versionpress/admin/deactivate.php';
     } else {
         $deactivationUrl = 'versionpress%2Fadmin%2Fdeactivate.php';
     }
     $this->assertContains($deactivationUrl, $this->url());
     $this->byCssSelector('#confirm_deactivation')->click();
     $this->assertContains('wp-admin/plugins.php', $this->url());
     $this->assertFileNotExists(self::$wpAutomation->getAbspath() . '/wp-includes/wpdb.php.original');
     $this->assertFileExists(self::$testConfig->testSite->path . '/.git');
 }