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


PHP Input::replace方法代码示例

本文整理汇总了PHP中Input::replace方法的典型用法代码示例。如果您正苦于以下问题:PHP Input::replace方法的具体用法?PHP Input::replace怎么用?PHP Input::replace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Input的用法示例。


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

示例1: testCanReplaceInputVlues

 public function testCanReplaceInputVlues()
 {
     $newInputs = ["get" => ["foo" => "Hello"], "post" => ["bar" => "World"]];
     $input = new Input();
     $input->replace($newInputs);
     $this->assertEquals($newInputs["get"]["foo"], $input->get("foo"));
     $this->assertEquals($newInputs["post"]["bar"], $input->post("bar"));
 }
开发者ID:brslv,项目名称:code,代码行数:8,代码来源:InputTests.php

示例2: testCanReplaceInputValues

 public function testCanReplaceInputValues()
 {
     $newInputs = array('get' => array('foo' => 'hello'), 'post' => array('bar' => 'World'));
     $input = new Input();
     $input->replace($newInputs);
     $this->assertEquals($newInputs['get']['foo'], $input->get('foo'));
     $this->assertEquals($newInputs['post']['bar'], $input->post('bar'));
 }
开发者ID:elagith,项目名称:learningMaterial,代码行数:8,代码来源:InputTest.php

示例3: store

 /**
  * Store a newly created category in storage.
  *
  * @return Response
  */
 public function store()
 {
     $categoryValidator = Validator::make($data = Input::all(), Category::$rules);
     if ($categoryValidator->fails()) {
         return Redirect::back()->withErrors($categoryValidator)->withInput();
     }
     /* Category */
     if (Input::has('createCategory')) {
         Category::create($data);
         $message = "登録しました。";
     }
     if (Input::has('deleteCategory')) {
         $c = Category::where('Bumon', Input::get('Bumon'))->first();
         Category::destroy($c->id);
         $message = "削除しました。";
         if (Input::has('selectedCategory')) {
             Input::replace(array('selectedCategory', ''));
         }
     }
     if (Input::has('updateCategory')) {
         $err = array('required' => '新しい部門名を入力してください。');
         $categoryValidator = Validator::make($data = Input::all(), Category::$update_rules, $err);
         if ($categoryValidator->fails()) {
             return Redirect::back()->withErrors($categoryValidator)->withInput();
         }
         $c = Category::where('Bumon', Input::get('Bumon'))->first();
         Category::destroy($c->id);
         $data['Bumon'] = $data['new_categoryName'];
         Category::create($data);
         $message = "更新しました。";
     }
     return Redirect::route('employees.index')->with('message', $message);
 }
开发者ID:noikiy,项目名称:posco-laravel-server,代码行数:38,代码来源:CategoriesController.php

示例4: runIndex

 public function runIndex($searchValue, $formInput, $returnValue, $returnValue2 = null, $returnValue3 = null)
 {
     Input::replace($formInput);
     $controller = new TestController();
     $view = $controller->index();
     $tests = $view->getData()['testSet'];
     if (isset($returnValue3)) {
         $field3 = $returnValue3;
         $field2 = $returnValue2;
     } elseif (isset($returnValue2)) {
         $field2 = $returnValue2;
     }
     $field = $returnValue;
     if (is_numeric($searchValue) && $field == 'specimen_id' | $field == 'visit_id') {
         if ($searchValue == '0') {
             $this->assertEquals($searchValue, count($tests));
         } else {
             $this->assertGreaterThanOrEqual(1, count($tests));
         }
     } else {
         foreach ($tests as $key => $test) {
             if (isset($field3)) {
                 $this->assertEquals($searchValue, $test->{$field}->{$field2}->{$field3});
             } elseif (isset($field2)) {
                 $this->assertEquals($searchValue, $test->{$field}->{$field2});
             } else {
                 $this->assertEquals($searchValue, $test->{$field});
             }
         }
     }
 }
开发者ID:BaobabHealthTrust,项目名称:iBLIS,代码行数:31,代码来源:TestControllerTest.php

示例5: update

 /**
  * Update the specified resource in storage.
  *
  * @return Response
  */
 public function update($id)
 {
     // Declare the rules for the form validation.
     //
     $rules = array();
     // Get all the inputs.
     //
     $inputs = Input::all();
     // If we are updating the password.
     //
     if (Input::get('password')) {
         // Update the validation rules.
         //
         $rules['password'] = 'Required|Confirmed';
         $rules['password_confirmation'] = 'Required';
     } else {
         // unset password fields once we are not updateing it
         //
         $input = Input::except(array('password', 'password_confirmation'));
         Input::replace($input);
     }
     // Validate the inputs.
     //
     $validator = Validator::make($inputs, $rules);
     // Check if the form validates with success.
     //
     if ($validator->fails()) {
         // Something went wrong.
         //
         return Redirect::to("/{$this->cmsAdminUrl}/{$this->package}/" . $id)->withErrors($validator->messages());
     }
     return parent::update($id);
 }
开发者ID:engoyan,项目名称:slender-cms,代码行数:38,代码来源:UsersController.php

示例6: testLoginSuccess

 public function testLoginSuccess()
 {
     Auth::shouldReceive('attempt')->once()->andReturn(true);
     Input::replace(array('email' => 'admin@admin.com', 'password' => 'password'));
     $this->post($this->prefix . 'login');
     $this->assertRedirectedToRoute(Config::get('empower::baseurl'));
 }
开发者ID:sorora,项目名称:aurp,代码行数:7,代码来源:AccessControllerTest.php

示例7: store

 /**
  * Store a newly created shop in storage.
  *
  * @return Response
  */
 public function store()
 {
     $shopValidator = Validator::make($data = Input::all(), Shop::$rules);
     if ($shopValidator->fails()) {
         return Redirect::back()->withErrors($shopValidator)->withInput();
     }
     /* Shop */
     if (Input::has('createShop')) {
         Shop::create($data);
     }
     $message = "登録しました。";
     if (Input::has('deleteShop')) {
         $s = Shop::where('Tenpo', Input::get('Tenpo'))->first();
         Shop::destroy($s->id);
         $message = "削除しました。";
         if (Input::has('selectedShop')) {
             Input::replace(array('selectedShop', ''));
         }
     }
     if (Input::has('updateShop')) {
         $messages = array('required' => '新しい店舗名を入力してください。');
         $shopValidator = Validator::make($data = Input::all(), Shop::$update_rules, $messages);
         if ($shopValidator->fails()) {
             return Redirect::back()->withErrors($shopValidator)->withInput();
         }
         $s = Shop::where('Tenpo', Input::get('Tenpo'))->first();
         Shop::destroy($s->id);
         $data['Tenpo'] = $data['new_shopName'];
         Shop::create($data);
         $message = "更新しました。";
     }
     return Redirect::route('employees.index')->with('message', $message);
 }
开发者ID:noikiy,项目名称:posco-laravel-server,代码行数:38,代码来源:ShopsController.php

示例8: store

 public function store()
 {
     $validator = Validator::make($data = Input::all(), Employee::$rules);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     /* Employee */
     if (Input::has('createEmployee')) {
         Employee::create($data);
     }
     $message = "登録しました。";
     if (Input::has('deleteEmployee')) {
         $e = Employee::where('name', Input::get('name'))->first();
         Employee::destroy($e->id);
         $message = "削除しました。";
         if (Input::has('selectedEmployee')) {
             Input::replace(array('selectedEmployee', ''));
         }
     }
     if (Input::has('updateEmployee')) {
         $validator_for_update = Validator::make($data = Input::all(), Employee::$update_rules);
         if ($validator_for_update->fails()) {
             return Redirect::back()->withErrors($validator_for_update)->withInput();
         }
         $e = Employee::where('name', Input::get('name'))->first();
         Employee::destroy($e->id);
         $data['name'] = $data['new_name'];
         Employee::create($data);
         $message = "更新しました。";
     }
     return Redirect::route('employees.index')->with('message', $message);
 }
开发者ID:noikiy,项目名称:posco-laravel-server,代码行数:32,代码来源:EmployeesController.php

示例9: testUpdateSuccess

 public function testUpdateSuccess()
 {
     Input::replace(array('title' => 'Foo', 'task' => 'Foo'));
     $this->mock->shouldReceive('findOrFail')->with(3)->once()->andReturn($this->mock);
     $this->mock->shouldReceive('update')->once()->andReturn(true);
     $this->put($this->url . '/3');
     $this->assertRedirectedToRoute($this->route . '.index');
 }
开发者ID:sorora,项目名称:bms,代码行数:8,代码来源:SeriesControllerTest.php

示例10: seedUser

 /**
  * Add products to the database
  *
  * @return void
  */
 private function seedUser()
 {
     User::truncate();
     UserAddress::truncate();
     Input::replace(array('username' => 'Test', 'email' => 'test@test.com', 'addresses' => array(array('address' => '123 Fake Street', 'city' => 'Faketon'), array('address' => '10 Test Street', 'city' => 'Testville'))));
     $user = new User();
     $user->saveRecursive();
 }
开发者ID:lakedawson,项目名称:vocal,代码行数:13,代码来源:UserSeeder.php

示例11: testHandleEditDuplicateOffer

 public function testHandleEditDuplicateOffer()
 {
     Input::replace($input = array('key_word' => 'offerone', 'url' => 'http://test.com'));
     $this->storageObject->shouldReceive('findOrFail')->once()->andReturn($this->storageObject);
     $this->storageObject->shouldReceive('isDuplicate')->once()->andReturn(true);
     $this->call('POST', '/edit', $input);
     $this->assertRedirectedToAction('OffersController@edit');
     $this->assertSessionHasErrors('duplicate');
 }
开发者ID:theantichris,项目名称:Retext,代码行数:9,代码来源:OffersControllerTest.php

示例12: testSendPromo

 public function testSendPromo()
 {
     Input::replace($input = array('From' => '5551234567', 'Body' => 'http://test.com'));
     $this->offer->url = 'http://test.com';
     $this->offer->shouldReceive('where')->once()->andReturn($this->offer);
     $this->messageProvider->shouldReceive('message')->once();
     $this->call('POST', '/promo', $input);
     $this->assertResponseOk();
 }
开发者ID:theantichris,项目名称:Retext,代码行数:9,代码来源:PromoControllerTest.php

示例13: testHandleLoginFailedAttempt

 public function testHandleLoginFailedAttempt()
 {
     Input::replace($input = array('email' => 'chris@theantichris.com', 'password' => 'test'));
     Validator::shouldReceive('make')->once()->andReturn(Mockery::mock(array('fails' => false)));
     Auth::shouldReceive('attempt')->once()->andReturn(false);
     $this->call('POST', '/login', $input);
     $this->assertRedirectedTo('/login');
     $this->assertSessionHasErrors('invalid');
 }
开发者ID:theantichris,项目名称:Retext,代码行数:9,代码来源:LoginControllerTest.php

示例14: testStoreFailsForInvalidData

 public function testStoreFailsForInvalidData()
 {
     $this->setupValidator(False);
     Input::replace(array('item' => 'foo'));
     $response = $this->test->store();
     $this->assertIsRedirectToIndex($response);
     $this->assertSessionHasErrors();
     $this->assertSessionHas('_old_input.item');
 }
开发者ID:viniciusferreira,项目名称:daily,代码行数:9,代码来源:TodosControllerTest.php

示例15: testDelete

 /**
  * Tests the update function in the SpecimenRejectionController
  */
 public function testDelete()
 {
     Input::replace($this->rejectionReasonData);
     $rejectionReason = new SpecimenRejectionController();
     $rejectionReason->store();
     $rejectionReasonstored = RejectionReason::orderBy('id', 'desc')->take(1)->get()->toArray();
     $rejectionReason->delete($rejectionReasonstored[0]['id']);
     $rejectionReasonDeleted = RejectionReason::find($rejectionReasonstored[0]['id']);
     $this->assertNull($rejectionReasonDeleted);
 }
开发者ID:BaobabHealthTrust,项目名称:iBLIS,代码行数:13,代码来源:SpecimenRejectionControllerTest.php


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