コード例 #1
0
ファイル: PhpspecTest.php プロジェクト: stefanhuber/Robo
 public function testPHPSpecCommand()
 {
     $task = $this->taskPhpspec('phpspec')->stopOnFail()->noCodeGeneration()->quiet()->verbose('vv')->noAnsi()->noInteraction()->format('pretty');
     verify($task->getCommand())->equals('phpspec run --stop-on-failure --no-code-generation --quiet -vv --no-ansi --no-interaction --format pretty');
     $task->run();
     $this->phpspec->verifyInvoked('executeCommand', ['phpspec run --stop-on-failure --no-code-generation --quiet -vv --no-ansi --no-interaction --format pretty']);
 }
コード例 #2
0
 public function testConvertCurrency(UnitTester $I)
 {
     $exchangeRate = new \Zidisha\Currency\ExchangeRate();
     $exchangeRate->setRate(80)->setCurrencyCode(Currency::CODE_KES);
     // convert to USD
     $money = Money::create('160', Currency::CODE_KES);
     $moneyUSD = Money::create('2.0', Currency::CODE_USD);
     verify($this->currencyService->convertToUSD($money, $exchangeRate))->equals($moneyUSD);
     // convert from USD
     $money = Money::create('240', Currency::CODE_KES);
     $moneyUSD = Money::create('3.0', Currency::CODE_USD);
     verify($this->currencyService->convertFromUSD($moneyUSD, Currency::create(Currency::CODE_KES), $exchangeRate))->equals($money);
     $failed = false;
     try {
         $money = Money::create('160', Currency::CODE_XOF);
         $this->currencyService->convertToUSD($money, $exchangeRate);
     } catch (\Zidisha\Currency\Exception\InvalidCurrencyExchangeException $e) {
         $failed = true;
     }
     verify($failed)->true();
     $failed = false;
     try {
         $this->currencyService->convertFromUSD($moneyUSD, Currency::create(Currency::CODE_XOF), $exchangeRate);
     } catch (\Zidisha\Currency\Exception\InvalidCurrencyExchangeException $e) {
         $failed = true;
     }
     verify($failed)->true();
 }
コード例 #3
0
ファイル: PHPUnitTest.php プロジェクト: stefanhuber/Robo
 public function testPHPUnitCommand()
 {
     $task = $this->taskPHPUnit('phpunit')->bootstrap('bootstrap.php')->filter('Model')->group('important')->xml('result.xml')->debug();
     verify($task->getCommand())->equals('phpunit --bootstrap bootstrap.php --filter Model --group important --log-junit result.xml --debug');
     $task->run();
     $this->phpunit->verifyInvoked('executeCommand', ['phpunit --bootstrap bootstrap.php --filter Model --group important --log-junit result.xml --debug']);
 }
コード例 #4
0
 /**
  * Do the Artisan commands fire?
  */
 public function testCommands()
 {
     $self = $this;
     $this->prepareSpecify();
     $this->specify('Boots', function () use($self) {
         $target = $self->getProvider(['package']);
         $target->shouldReceive('package');
         $target->boot();
     });
     $this->prepareSpecify();
     $this->specify('Identifies provisions', function () use($self) {
         $target = $self->getProvider();
         verify($target->provides())->notEmpty();
     });
     $this->prepareSpecify();
     $this->specify('Binds to application', function () use($self) {
         App::shouldReceive('bind')->with('/^toolbox\\.commands\\./', Mockery::on(function ($closure) {
             $command = $closure();
             verify_that('is a command', is_a($command, 'Illuminate\\Console\\Command'));
             return true;
         }));
         Event::shouldReceive('listen')->with('toolbox.build', Mockery::on(function ($closure) {
             $app = Mockery::mock('Illuminate\\Console\\Application[call]');
             $app->shouldReceive('call');
             $command = $closure($app);
             return true;
         }));
         $target = $self->getProvider(['commands']);
         $target->shouldReceive('commands')->with(Mockery::type('array'));
         $target->register();
     });
 }
コード例 #5
0
function nav()
{
    unset($_SESSION['index_class']);
    unset($_SESSION['editmix_class']);
    unset($_SESSION['validate_class']);
    unset($_SESSION['makemix_class']);
    unset($_SESSION['mwbedocs_class']);
    unset($_SESSION['upfiles_class']);
    if ($_SESSION['action'] == "index") {
        index();
    } elseif ($_SESSION['action'] == "makemix") {
        makemix();
    } elseif ($_SESSION['action'] == "upfiles") {
        upfiles();
    } elseif ($_SESSION['action'] == "verify") {
        verify();
    } elseif ($_SESSION['action'] == "validate") {
        validate();
    } elseif ($_SESSION['action'] == "editmix") {
        editmix();
    } elseif ($_SESSION['action'] == "mwbedocs") {
        mwbedocs();
    } elseif ($_SESSION['action'] == "delmix") {
        delmix();
    } else {
        index();
    }
}
コード例 #6
0
 public function testLogin()
 {
     $this->form = new LoginForm();
     $this->specify('should not allow logging in blocked users', function () {
         $user = $this->getFixture('user')->getModel('blocked');
         $this->form->setAttributes(['login' => $user->email, 'password' => 'qwerty']);
         verify($this->form->validate())->false();
         verify($this->form->getErrors('login'))->contains('Your account has been blocked');
     });
     $this->specify('should not allow logging in unconfirmed users', function () {
         \Yii::$app->getModule('user')->enableConfirmation = true;
         \Yii::$app->getModule('user')->enableUnconfirmedLogin = false;
         $user = $this->getFixture('user')->getModel('user');
         $this->form->setAttributes(['login' => $user->email, 'password' => 'qwerty']);
         verify($this->form->validate())->true();
         $user = $this->getFixture('user')->getModel('unconfirmed');
         $this->form->setAttributes(['login' => $user->email, 'password' => 'unconfirmed']);
         verify($this->form->validate())->false();
         \Yii::$app->getModule('user')->enableUnconfirmedLogin = true;
         verify($this->form->validate())->true();
     });
     $this->specify('should log the user in with correct credentials', function () {
         $user = $this->getFixture('user')->getModel('user');
         $this->form->setAttributes(['login' => $user->email, 'password' => 'wrong']);
         verify($this->form->validate())->false();
         $this->form->setAttributes(['login' => $user->email, 'password' => 'qwerty']);
         verify($this->form->validate())->true();
     });
 }
コード例 #7
0
 /**
  * Output the POS template
  */
 public function template_redirect()
 {
     // check is pos
     if (!is_pos('template')) {
         return;
     }
     // check auth
     if (!is_user_logged_in()) {
         add_filter('login_url', array($this, 'login_url'));
         auth_redirect();
     }
     //check store table
     if (verify() == -1) {
         wp_die(__('You are not listed as a store employee or administrator.'));
     }
     // check privileges
     if (!current_user_can('access_woocommerce_pos')) {
         /* translators: wordpress */
         wp_die(__('You do not have sufficient permissions to access this page.'));
     }
     // disable cache plugins
     $this->no_cache();
     // last chance before template is rendered
     do_action('woocommerce_pos_template_redirect');
     // add head & footer actions
     add_action('woocommerce_pos_head', array($this, 'head'));
     add_action('woocommerce_pos_footer', array($this, 'footer'));
     // now show the page
     include 'views/template.php';
     exit;
 }
コード例 #8
0
 public function testProcessProlog()
 {
     $I = $this->tester;
     $this->tester->wantToTest("processing the prolog and importing the file into the database");
     $this->import->setCsvReader($this->import->file);
     $this->import->processProlog();
     $prolog = $this->import->prolog;
     $this->assertEquals(14, count($prolog['columns']), "There are the correct number of columns");
     $this->assertEquals(6, count($prolog['prefix']), "There are the correct number of prefix entries");
     $this->assertEquals(10, count($prolog['meta']), "There are the correct number of meta entries");
     $this->import->getDataColumnIds();
     $this->import->processData();
     $results = $this->import->results['success'];
     verify(
       "There were 8 rows processed",
       count($results['rows'])
     )->equals(12);
     $this->import->processParents();
     $I->seeRecordCountInDatabaseTable("SchemaPropertyElement", 138);
     $I->seeRecordCountInDatabaseTable("SchemaProperty", 12);
     //prolog namespace entries are readable
     //prolog headers are actually in row 1
     //prolog headers not in row 1 produce fatal error (logged)
     //prolog entries can be matched to database (column uri matched to profile id)
     //prolog entries that can't be matched produce fatal error (logged)
 } //
コード例 #9
0
ファイル: Users.php プロジェクト: aldsdelram/PUPNLPWebsite
 public function login()
 {
     check_if_already_logged_in();
     $data['page'] = "login";
     $data['newline'] = "<br/>";
     if (isset($_POST['btnLogin'])) {
         $username = $_POST["username"];
         $password = $_POST["password"];
         if ($user_info = $this->Users_model->find($username)) {
             $user_data = $this->Users_model->find_info($user_info['id']);
             if (verify($password, $user_info["password"], $user_info["salt"])) {
                 $v = $this->Users_model->validity($user_info['id']);
                 $newdata = array('id' => $user_info['id'], 'username' => $username, 'type' => $user_info['type'], 'validity' => $v['validity'], 'user_info' => $user_data);
                 $this->session->set_userdata($newdata);
                 header('Location: home');
             } else {
                 echo "false";
             }
         } else {
             echo "Check your password or username";
         }
     }
     $this->load->view('templates/header');
     $this->load->view('users/login', $data);
     $this->load->view('templates/footer');
 }
コード例 #10
0
ファイル: ExecCest.php プロジェクト: zondor/Robo
 public function toExecLsCommand(CliGuy $I)
 {
     $command = strncasecmp(PHP_OS, 'WIN', 3) == 0 ? 'dir' : 'ls';
     $res = $I->taskExec($command)->run();
     verify($res->getMessage())->contains('src');
     verify($res->getMessage())->contains('codeception.yml');
 }
コード例 #11
0
ファイル: ComposerTest.php プロジェクト: stefanhuber/Robo
 public function testComposerDumpAutoloadCommand()
 {
     verify($this->taskComposerDumpAutoload('composer')->getCommand())->equals('composer dump-autoload');
     verify($this->taskComposerDumpAutoload('composer')->noDev()->getCommand())->equals('composer dump-autoload --no-dev');
     verify($this->taskComposerDumpAutoload('composer')->optimize()->getCommand())->equals('composer dump-autoload --optimize');
     verify($this->taskComposerDumpAutoload('composer')->optimize()->noDev()->getCommand())->equals('composer dump-autoload --optimize --no-dev');
 }
コード例 #12
0
ファイル: WorkflowTest.php プロジェクト: fproject/workflowii
 public function testWorkflowCached()
 {
     $this->factory->addWorkflowDefinition('wid', ['initialStatusId' => 'A', 'status' => ['A']]);
     $this->specify('workflow are loaded once', function () {
         verify('workflow instances are the same', spl_object_hash($this->factory->getWorkflow('wid', null)))->equals(spl_object_hash($this->factory->getWorkflow('wid', null)));
     });
 }
コード例 #13
0
ファイル: AtoumTest.php プロジェクト: jjok/Robo
 public function testAtoumCommand()
 {
     $task = (new \Robo\Task\Testing\Atoum('atoum'))->bootstrap('bootstrap.php')->tags("needDb")->lightReport()->tap()->bootstrap('tests/bootstrap.php')->configFile("config/dev.php")->debug()->files(array("path/to/file1.php", "path/to/file2.php"))->directories("tests/units");
     verify($task->getCommand())->equals('atoum --bootstrap bootstrap.php --tags needDb --use-light-report --use-tap-report --bootstrap tests/bootstrap.php -c config/dev.php --debug --f path/to/file1.php --f path/to/file2.php --directories tests/units');
     $task->run();
     $this->atoum->verifyInvoked('executeCommand', ['atoum --bootstrap bootstrap.php --tags needDb --use-light-report --use-tap-report --bootstrap tests/bootstrap.php -c config/dev.php --debug --f path/to/file1.php --f path/to/file2.php --directories tests/units']);
 }
コード例 #14
0
ファイル: ParallelExecTest.php プロジェクト: sliver/Robo
 public function testParallelExec()
 {
     $result = $this->taskParallelExec()->process('ls 1')->process('ls 2')->process('ls 3')->run();
     $this->process->verifyInvokedMultipleTimes('start', 3);
     verify($result->getExitCode())->equals(0);
     $this->guy->seeInOutput("3 processes ended in 0.00 s");
 }
コード例 #15
0
ファイル: SemVerTest.php プロジェクト: sliver/Robo
 public function testSemver()
 {
     $semver = test::double('Robo\\Task\\SemVerTask', ['dump' => null]);
     $res = $this->taskSemVer()->increment('major')->prerelease('RC')->increment('patch')->run();
     verify($res->getMessage())->equals('v1.0.1-RC.1');
     $semver->verifyInvoked('dump');
 }
コード例 #16
0
 public function actionReturn()
 {
     if (verify($_POST) && $_POST['respCode'] == '00') {
         $this->update_order();
     }
     $this->redirect($this->createUrl('site/orders?msg=' . urlencode('订单支付成功,订单号为:' . $_POST['orderId'])));
 }
コード例 #17
0
 /**
  * @tests
  */
 public function parser_should_use_prefetch_count_from_annotation()
 {
     $parser = new Parser(new AnnotationReader());
     $consumer = new ConsumerWithPrefetchCount();
     $consumerMethods = $parser->getConsumerMethods($consumer);
     $consumerMethod = $consumerMethods[0];
     verify($consumerMethod->getPrefetchCount())->equals(100);
 }
コード例 #18
0
ファイル: OperatorDivTest.php プロジェクト: lrusev/formula
 public function testIsInterfaceImplemented()
 {
     $leftOperand = M::mock('Lrusev\\Formula\\Operand\\Number', ['getValue' => 5]);
     $rightOperand = M::mock('Lrusev\\Formula\\Operand\\Number', ['getValue' => 15]);
     $operator = new Div($leftOperand, $rightOperand);
     verify("operator implement Lrusev\\Formula\\Operand\\OperandInterface", $operator)->isInstanceOf('Lrusev\\Formula\\Operand\\OperandInterface');
     verify("operator implement Lrusev\\Formula\\Operator\\OperatorInterface", $operator)->isInstanceOf('Lrusev\\Formula\\Operator\\OperatorInterface');
 }
コード例 #19
0
 public function testLoadWorkflowSuccess2()
 {
     $src = new WorkflowFileSource();
     $src->addWorkflowDefinition('wid', ['initialStatusId' => 'A', 'status' => ['A' => ['label' => 'Entry', 'transition' => 'A,B'], 'B' => ['label' => 'Published', 'transition' => '  A  , B  ']]]);
     verify($src->getStatus('wid/A'))->notNull();
     verify($src->getStatus('wid/B'))->notNull();
     verify(count($src->getTransitions('wid/A')))->equals(2);
 }
コード例 #20
0
ファイル: unionpay.php プロジェクト: onlineshine/myzf
 public function Verify($data)
 {
     if (isset($data['signature'])) {
         return verify($data);
     } else {
         return false;
     }
 }
コード例 #21
0
ファイル: RsyncTest.php プロジェクト: codegyre/robo
 public function testRsync()
 {
     verify((new \Robo\Task\Remote\Rsync())->fromPath('src/')->toHost('localhost')->toUser('dev')->toPath('/var/www/html/app/')->recursive()->excludeVcs()->checksum()->wholeFile()->verbose()->progress()->humanReadable()->stats()->getCommand())->equals('rsync --recursive --exclude .git --exclude .svn --exclude .hg --checksum --whole-file --verbose --progress --human-readable --stats src/ \'dev@localhost:/var/www/html/app/\'');
     // From the folder 'foo bar' (with space) in 'src' directory
     verify((new \Robo\Task\Remote\Rsync())->fromPath('src/foo bar/baz')->toHost('localhost')->toUser('dev')->toPath('/var/path/with/a space')->getCommand())->equals('rsync \'src/foo bar/baz\' \'dev@localhost:/var/path/with/a space\'');
     // Copy two folders, 'src/foo' and 'src/bar'
     verify((new \Robo\Task\Remote\Rsync())->fromPath(['src/foo', 'src/bar'])->toHost('localhost')->toUser('dev')->toPath('/var/path/with/a space')->getCommand())->equals('rsync src/foo src/bar \'dev@localhost:/var/path/with/a space\'');
 }
コード例 #22
0
ファイル: BehatTest.php プロジェクト: jjok/Robo
 public function testBehatCommand()
 {
     $behat = test::double('Robo\\Task\\Testing\\Behat', ['executeCommand' => null, 'getConfig' => new \Robo\Config(), 'logger' => new \Psr\Log\NullLogger()]);
     $task = (new \Robo\Task\Testing\Behat('behat'))->stopOnFail()->noInteraction()->colors();
     verify($task->getCommand())->equals('behat run --stop-on-failure --no-interaction --colors');
     $task->run();
     $behat->verifyInvoked('executeCommand', ['behat run --stop-on-failure --no-interaction --colors']);
 }
コード例 #23
0
 public function testLoadWorkflowSuccess2()
 {
     $factory = new ArrayWorkflowItemFactory();
     $factory->addWorkflowDefinition('wid', ['initialStatusId' => 'A', 'status' => ['A' => ['label' => 'Entry', 'transition' => 'A,B'], 'B' => ['label' => 'Published', 'transition' => '  A  , B  ']]]);
     verify($factory->getStatus('wid/A', null, null))->notNull();
     verify($factory->getStatus('wid/B', null, null))->notNull();
     verify(count($factory->getTransitions('wid/A', null, null)))->equals(2);
 }
コード例 #24
0
 /**
  * Tests adapter page 2 content.
  */
 public function testGetSlicePage2()
 {
     $this->service->expects($this->any())->method('execute')->with($this->search)->will($this->returnValue(['hits' => ['total' => 4, 'hits' => [['_source' => ['id' => 'd3', 'field1' => 'value1']], ['_source' => ['id' => 'd4', 'field1' => 'value1']]]]]));
     $this->specify('getting page 2 results', function () {
         verify($this->adapter->getSlice(2, 2))->equals([['_source' => ['id' => 'd3', 'field1' => 'value1']], ['_source' => ['id' => 'd4', 'field1' => 'value1']]]);
         verify($this->adapter->getNbResults())->equals(4);
     });
 }
コード例 #25
0
ファイル: UnionPay.class.php プロジェクト: xingluxin/jianshen
 public function Check($result)
 {
     if (verify($result)) {
         return true;
     } else {
         return false;
     }
 }
コード例 #26
0
 public function testOpeningTheFile()
 {
     $reader = $this->import->setCsvReader($this->import->file);
     verify(
           "Reading the file doesn't return an error",
           get_class($reader)
     )->equals("Ddeboer\\DataImport\\Reader\\CsvReader");
 }
コード例 #27
0
 public function testIsValid()
 {
     $examples = [['secret', ['action' => 'checkOrder', 'orderSumAmount' => '87.10', 'orderSumCurrencyPaycash' => '643', 'orderSumBankPaycash' => '1001', 'shopId' => '13', 'invoiceId' => '1234567', 'customerNumber' => '8123294469', 'md5' => '6f58d99969865670ee52bbfd2c03fb90']], ['s<kY23653f,{9fcnshwq', ['action' => 'checkOrder', 'orderSumAmount' => '87.10', 'orderSumCurrencyPaycash' => '643', 'orderSumBankPaycash' => '1001', 'shopId' => '13', 'invoiceId' => '55', 'customerNumber' => '8123294469', 'md5' => '1B35ABE38AA54F2931B0C58646FD1321']]];
     $this->specify('Request must be a valid if md5 is matching', function ($shopPassword, $requestData) {
         $request = $this->createRequest($shopPassword, $requestData);
         verify($request->isValid())->true();
     }, ['examples' => $examples]);
 }
コード例 #28
0
 /**
  *
  */
 public function testAssertGetClientId()
 {
     $this->specify('verify service can getClientId', function () {
         $service = new OAuth2Service($this->createAuthorizationServer(), $this->createResourceServer());
         $service->validateAccessToken(true, self::$token['access_token']);
         verify($service->getClientId())->equals('test');
     });
 }
コード例 #29
0
ファイル: PHPServerTest.php プロジェクト: stefanhuber/Robo
 public function testServerCommand()
 {
     if (strtolower(PHP_OS) === 'linux') {
         $expectedCommand = 'exec php -S 127.0.0.1:8000 -t web';
     } else {
         $expectedCommand = 'php -S 127.0.0.1:8000 -t web';
     }
     verify($this->taskServer('8000')->host('127.0.0.1')->dir('web')->getCommand())->equals($expectedCommand);
 }
コード例 #30
0
ファイル: PHPServerTest.php プロジェクト: jjok/Robo
 public function testServerCommand()
 {
     if (strtolower(PHP_OS) === 'linux') {
         $expectedCommand = 'exec php -S 127.0.0.1:8000 -t web';
     } else {
         $expectedCommand = 'php -S 127.0.0.1:8000 -t web';
     }
     verify((new \Robo\Task\Development\PhpServer('8000'))->host('127.0.0.1')->dir('web')->getCommand())->equals($expectedCommand);
 }