当前位置: 首页>>代码示例>>PHP>>正文


PHP codecept_data_dir函数代码示例

本文整理汇总了PHP中codecept_data_dir函数的典型用法代码示例。如果您正苦于以下问题:PHP codecept_data_dir函数的具体用法?PHP codecept_data_dir怎么用?PHP codecept_data_dir使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了codecept_data_dir函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setUp

 protected function setUp()
 {
     $this->app = $app = new Container();
     $db_config = ['driver' => 'pdo_sqlite', 'dbname' => 'sqlite:///:memory:'];
     $models = ['post.model' => function () use($app) {
         return new Post($app);
     }, 'comment.model' => 'Comment'];
     $app['db'] = function () use($db_config) {
         $db = \Doctrine\DBAL\DriverManager::getConnection($db_config);
         $sql = file_get_contents(codecept_data_dir() . '/dump.sql');
         $db->exec($sql);
         return $db;
     };
     foreach ($models as $name => $class) {
         if (is_callable($class)) {
             $callable = $class;
         } else {
             $callable = function () use($class, $app) {
                 return new $class($app);
             };
         }
         $app[$name] = $app->factory($callable);
     }
     $this->loadFixtures();
 }
开发者ID:arduanov,项目名称:pimple-active-record,代码行数:25,代码来源:RecordTest.php

示例2: testImageComparer

 public function testImageComparer(FunctionalTester $I)
 {
     $I->amInPath($this->workDir);
     copy(codecept_data_dir() . 'image1.png', $this->workDir . '/image1.png');
     copy(codecept_data_dir() . 'image2.png', $this->workDir . '/image2.png');
     copy(codecept_data_dir() . 'image3.png', $this->workDir . '/image3.png');
     $comparer = new ImageComparer();
     // Check difference between the same image.
     $difference = $comparer->difference('image1.png', 'image1.png', 'image.diff.png');
     $I->assertTrue($difference === 0);
     $I->assertTrue(file_exists('image.diff.png'));
     unlink('image.diff.png');
     // Compare different images.
     $difference = $comparer->difference('image1.png', 'image2.png', 'image.diff.png');
     $I->assertTrue($difference > 0);
     codecept_debug($difference);
     $I->assertTrue(file_exists('image.diff.png'));
     // Compare different sized images.
     $difference = $comparer->difference('image1.png', 'image3.png', 'image.diff.png');
     $I->assertTrue($difference > 0);
     codecept_debug($difference);
     $I->assertTrue(file_exists('image.diff.png'));
     // Check missing command.
     $comparer->setCommand('this_command_doesnt_exist');
     try {
         $difference = $comparer->difference('image1.png', 'image2.png', 'image.diff.png');
         $I->fail("Bad command didn't throw an Exception");
     } catch (Exception $e) {
         // All good.
     }
 }
开发者ID:xendk,项目名称:argus,代码行数:31,代码来源:ImageComparerCest.php

示例3: haveAFileLikeThis

 /**
  * @param string $fileName
  *
  * @return $this
  */
 public function haveAFileLikeThis($fileName)
 {
     $expectedDir = codecept_data_dir('expected');
     $actualDir = codecept_data_dir('actual');
     Assert::assertContains(file_get_contents("{$expectedDir}/{$fileName}"), file_get_contents("{$actualDir}/{$fileName}"));
     return $this;
 }
开发者ID:cheppers,项目名称:robo-phpcs,代码行数:12,代码来源:AcceptanceTester.php

示例4: testLoadAllTests

 /**
  * @group core
  */
 public function testLoadAllTests()
 {
     $this->testLoader = new \Codeception\TestLoader(codecept_data_dir() . 'claypit/tests');
     $this->testLoader->loadTests();
     $this->assertContainsTestName('order/AnotherCept', $this->testLoader->getTests());
     $this->assertContainsTestName('MageGuildCest::darkPower', $this->testLoader->getTests());
     $this->assertContainsTestName('FailingTest::testMe', $this->testLoader->getTests());
 }
开发者ID:itillawarra,项目名称:cmfive,代码行数:11,代码来源:TestLoaderTest.php

示例5: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $host = $input->getOption('host');
     $user = $input->getOption('user');
     $pass = $input->getOption('pass');
     $dbName = $input->getArgument('name');
     try {
         $this->dump = $this->pdoFactory->makeDump($host, $user, $pass, $dbName);
     } catch (\PDOException $e) {
         throw new RuntimeException('Error while connecting to database [' . $dbName . ']: ' . $e->getMessage());
     }
     if (false === $this->dump) {
         $output->writeln('<error>Something went wrong with the dump component instance.</error>');
         return false;
     }
     \Codeception\Configuration::config();
     if (!empty($input->getOption('dump-file'))) {
         $dumpFile = $input->getOption('dump-file');
     } else {
         $dumpFile = codecept_data_dir($input->getArgument('snapshot') . '.sql');
     }
     $output->writeln('<info>Dump file will be written to [' . $dumpFile . ']</info>');
     if (!empty($input->getOption('dist-dump-file'))) {
         $distDumpFile = $input->getOption('dist-dump-file');
     } else {
         $distDumpFile = codecept_data_dir($input->getArgument('snapshot') . '.dist.sql');
     }
     $output->writeln('<info>Distribution version of dump file will be written to [' . $distDumpFile . ']</info>');
     $skipTables = $input->getOption('skip-tables');
     if (!empty($skipTables)) {
         $tables = explode(',', $skipTables);
         foreach ($tables as $table) {
             $this->dump->tables[$table] = \MySQLDump::NONE;
         }
     }
     $memory = fopen('php://memory', 'w');
     $this->dump->write($memory);
     rewind($memory);
     $dumpContents = stream_get_contents($memory);
     if (!$this->filesystem->file_put_contents($dumpFile, $dumpContents)) {
         $output->writeln('<error>Could not write dump to [' . $dumpFile . ']</error>');
         return false;
     }
     $output->writeln('<info>Dump file written to [' . $dumpFile . ']</info>');
     $localUrl = $input->getOption('local-url');
     $distUrl = $input->getOption('dist-url');
     $localDomain = rtrim(preg_replace('~http(s)*:\\/\\/(www\\.)*~', '', $localUrl), '/');
     $distDomain = rtrim(preg_replace('~http(s)*:\\/\\/(www\\.)*~', '', $distUrl), '/');
     $distDumpContents = str_replace($localDomain, $distDomain, $dumpContents);
     if (!$this->filesystem->file_put_contents($distDumpFile, $distDumpContents)) {
         $output->writeln('<error>Could not write dist dump to [' . $distDumpFile . ']</error>');
         return false;
     }
     $output->writeln('<info>Distribution version of dump file written to [' . $distDumpFile . ']</info>');
     $output->writeln('<comment>Any occurrence of [' . $localDomain . '] in it was replaced with [' . $distDomain . ']</comment>');
     parent::execute($input, $output);
     return true;
 }
开发者ID:lucatume,项目名称:wp-browser,代码行数:58,代码来源:DbSnapshot.php

示例6: checkOtherReasonRequest

 public function checkOtherReasonRequest()
 {
     $I = $this;
     $advFlatId = file_get_contents(codecept_data_dir('advertFlatId.json'));
     $I->amOnPage(AdvertsList::$URL . '/' . $advFlatId . '/edit');
     $I->waitForElement(AdvertsList::$editAdvObjInfoTab);
     $I->see(Lists::unpubReason1, AdvertsList::$advInfoTable);
     $I->see(Flat::descriptionOtherReason, AdvertsList::$advInfoTable);
     $I->see(Lists::status3, AdvertsList::$advInfoTable);
 }
开发者ID:kdl-qa,项目名称:vpn-codeception,代码行数:10,代码来源:UnpublishAdvert.php

示例7: haveAValidCheckstyleReport

 /**
  * @param string $fileName
  *
  * @return $this
  */
 public function haveAValidCheckstyleReport($fileName)
 {
     $fileName = codecept_data_dir($fileName);
     $doc = new \DOMDocument();
     $doc->loadXML(file_get_contents($fileName));
     $xpath = new DOMXPath($doc);
     $rootElement = $xpath->query('/checkstyle');
     Assert::assertEquals(1, $rootElement->length, 'Root element of the Checkstyle XML is exists.');
     return $this;
 }
开发者ID:cheppers,项目名称:robo-scss-lint,代码行数:15,代码来源:AcceptanceTester.php

示例8: testTags

 public function testTags()
 {
     $this->loader = new \Codeception\Test\Loader\Gherkin(['gherkin' => ['contexts' => ['default' => ['GherkinTestContext'], 'tag' => ['important' => ['TagGherkinContext']]]]]);
     $this->loader->loadTests(codecept_data_dir('refund.feature'));
     $test = $this->loader->getTests()[0];
     /** @var $test \Codeception\Test\Gherkin  * */
     $test->getMetadata()->setServices($this->getServices());
     $test->test();
     $this->assertEquals('aXc', self::$calls);
 }
开发者ID:neronmoon,项目名称:Codeception,代码行数:10,代码来源:GherkinTest.php

示例9: _before

 protected function _before()
 {
     $config = ['driver' => 'pdo_sqlite', 'dbname' => 'sqlite:///:memory:'];
     $this->db = \Doctrine\DBAL\DriverManager::getConnection($config);
     $schema = file_get_contents(codecept_data_dir() . '/dump.sql');
     $this->db->exec($schema);
     //        $this->db->insert('table_comment',['username'=>'tester','post_id'=>1]);
     //        $this->db->query('select * from table_comment')->fetchAll();
     $this->record = new Record();
     $this->record->connection($this->db);
 }
开发者ID:arduanov,项目名称:simple-record,代码行数:11,代码来源:SimpleRecordTest.php

示例10: setUp

 public function setUp()
 {
     $this->dispatcher = new Symfony\Component\EventDispatcher\EventDispatcher();
     $di = new \Codeception\Lib\Di();
     $this->moduleContainer = new \Codeception\Lib\ModuleContainer($di, []);
     \Codeception\Module\EmulateModuleHelper::$onlyActions = [];
     \Codeception\Module\EmulateModuleHelper::$excludeActions = [];
     $module = $this->moduleContainer->create('EmulateModuleHelper');
     $module->_initialize();
     $this->testcase = new \Codeception\TestCase\Cept();
     $this->testcase->configDispatcher($this->dispatcher)->configName('mocked test')->configFile(codecept_data_dir() . 'SimpleCept.php')->configDi($di)->configModules($this->moduleContainer)->initConfig();
 }
开发者ID:hitechdk,项目名称:Codeception,代码行数:12,代码来源:TestCaseTest.php

示例11: testLoadAllTests

 /**
  * @group core
  */
 public function testLoadAllTests()
 {
     Codeception\Util\Autoload::addNamespace('Math', codecept_data_dir() . 'claypit/tests/_support/Math');
     // to autoload dependencies
     $this->testLoader = new \Codeception\Test\Loader(['path' => codecept_data_dir() . 'claypit/tests']);
     $this->testLoader->loadTests();
     $testNames = $this->getTestNames($this->testLoader->getTests());
     $this->assertContainsTestName('AnotherCept', $testNames);
     $this->assertContainsTestName('MageGuildCest:darkPower', $testNames);
     $this->assertContainsTestName('FailingTest:testMe', $testNames);
     $this->assertContainsTestName('MathCest:testAddition', $testNames);
     $this->assertContainsTestName('MathTest:testAll', $testNames);
 }
开发者ID:foxman209,项目名称:Codeception,代码行数:16,代码来源:TestLoaderTest.php

示例12: uniqueCadastralNumber

 static function uniqueCadastralNumber()
 {
     //        if (self::$currentCadastralNumber) {
     //            return self::$currentCadastralNumber;
     //        }
     //        $number = trim(file_get_contents(codecept_data_dir('cadastral_number.txt')),":");
     //        $number = trim($constFileName, ':');
     $number = substr(str_shuffle("1234567890123456789"), 0, 19);
     //        self::$currentCadastralNumber = $number;
     self::$currentCadastralNumber = preg_replace("/^(.{10})(.{2})(.{3})(.{4})\$/", "\$1:\$2:\$3:\$4", $number);
     file_put_contents(codecept_data_dir('cadastral_number.txt'), self::$currentCadastralNumber);
     return $number;
 }
开发者ID:kdl-qa,项目名称:vpn-codeception,代码行数:13,代码来源:Parcel.php

示例13: checkAdvFlatProperties

 public function checkAdvFlatProperties()
 {
     $I = $this;
     $advFlatId = file_get_contents(codecept_data_dir('advertFlatId.json'));
     $I->amOnPage(AdvertsList::$URL . '/' . $advFlatId . '/edit');
     $I->waitForElement(AdvertsList::$editAdvObjInfoTab);
     $I->see(Flat::status0, AdvertsList::$editAdvStatus);
     $I->click(AdvertsList::$editAdvObjInfoTab);
     $I->see(Flat::category, AdvertsList::$editAdvObjTable);
     $I->see(Flat::categoryType0, AdvertsList::$editAdvObjTable);
     $I->see(Flat::region, AdvertsList::$editAdvObjTable);
     $I->see(Flat::city, AdvertsList::$editAdvObjTable);
     $I->see(Flat::houseNumber, AdvertsList::$editAdvObjTable);
     $I->see(Flat::$currentFlatNumber, AdvertsList::$editAdvObjTable);
     $I->click(AdvertsList::$editAdvTab);
     $I->waitForElement(AdvertsList::$editAdvDescription);
     $I->see(Flat::operationType1, AdvertsList::$editAdvOperationType);
     $desVal = $I->grabValueFrom(AdvertsList::$editAdvDescription);
     codecept_debug($desVal);
     if ($desVal !== Flat::descriptionFlatSell) {
         $I->see('error!!!');
     }
     //        $I->see(Flat::descriptionFlatSell, AdvertsList::$editAdvDescription);
     //        $I->seeInFormFields('form[name=createAdvertForm]',['description' => Flat::descriptionFlatSell]);
     //        $I->seeInField(AdvertsList::$editAdvDescription, Flat::descriptionFlatSell);
     $priceVal = $I->grabValueFrom(AdvertsList::$editAdvPrice);
     codecept_debug($priceVal);
     if ($priceVal !== Flat::priceFlatSell) {
         $I->see('error!!!');
     }
     //        $I->see(Flat::priceFlatSell, AdvertsList::$editAdvPrice);
     $I->see(Flat::market1, AdvertsList::$editAdvMarketType);
     $I->see(Flat::repair0, AdvertsList::$editAdvRepair);
     $ownNameVal = $I->grabValueFrom(AdvertsList::$editAdvOwnerName);
     codecept_debug($ownNameVal);
     if ($ownNameVal !== Flat::ownerName) {
         $I->see('error!!!');
     }
     //        $I->see(Flat::ownerName, AdvertsList::$editAdvOwnerName);
     $ownContactVal = $I->grabValueFrom(AdvertsList::$editAdvOwnerContacts);
     codecept_debug($ownContactVal);
     if ($ownContactVal !== Flat::ownerContacts) {
         $I->see('error!!!');
     }
     //        $I->see(Flat::ownerContacts, AdvertsList::$editAdvOwnerContacts);
     $I->see('Я владелец', AdvertsList::$editAdvOwnerLink);
     $I->see('Сохранить', AdvertsList::$editAdvSubmit);
 }
开发者ID:kdl-qa,项目名称:vpn-codeception,代码行数:48,代码来源:UserAdvertsList.php

示例14: testWebsiteScraper_aPageWithoutItemsReturnsException

 public function testWebsiteScraper_aPageWithoutItemsReturnsException()
 {
     $mockDownloader = \Mockery::mock(WebsiteDownloader::class);
     $mockDownloader->shouldReceive('download')->once()->andReturn(file_get_contents(codecept_data_dir() . 'plpPage.html'));
     $sampleProduct = new Product("Title", "Description", "0.01", "Big");
     $mockPDPParser = \Mockery::mock(PDPParser::class);
     $mockPDPParser->shouldReceive('parseUrl')->times(7)->andReturn($sampleProduct);
     $pdpParser = new WebsiteScraper($mockPDPParser, $mockDownloader);
     $productResults = $pdpParser->getProductsForUrl('http://fakeUrl.com');
     $products = $productResults->getProducts();
     $this->assertEquals(7, count($products));
     $this->assertEquals("Title", $products[0]->title);
     $this->assertEquals("Description", $products[0]->description);
     $this->assertEquals("0.01", $products[0]->price);
     $this->assertEquals("Big", $products[0]->size);
 }
开发者ID:slice-beans,项目名称:cli-app,代码行数:16,代码来源:AllTest.php

示例15: testGroupEventsAreFired

 public function testGroupEventsAreFired()
 {
     $events = [];
     $eventListener = function ($event, $eventName) use(&$events) {
         $events[] = $eventName;
     };
     $this->dispatcher->addListener('test.before', $eventListener);
     $this->dispatcher->addListener('test.before.admin', $eventListener);
     $this->dispatcher->addListener('test.after', $eventListener);
     $this->dispatcher->addListener('test.after.admin', $eventListener);
     $this->suiteman->loadTests(codecept_data_dir() . 'SimpleAdminGroupCest.php');
     $this->suiteman->run($this->runner, new \PHPUnit_Framework_TestResult(), ['silent' => true, 'colors' => false, 'steps' => true, 'debug' => false]);
     $this->assertContains('test.before', $events);
     $this->assertContains('test.before.admin', $events);
     $this->assertContains('test.after.admin', $events);
 }
开发者ID:kansey,项目名称:yii2albom,代码行数:16,代码来源:SuiteManagerTest.php


注:本文中的codecept_data_dir函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。