public function testStoreSuccess() { Input::replace(Factory::attributesFor($this->factory)); $this->mock->shouldReceive('create')->once()->andReturn($this->mock); $this->post($this->url); $this->assertRedirectedToRoute($this->route . '.index'); }
public function test_validacion_exitosa_con_clave_foranea_lugar() { $padre = Factory::create('App\\Lugar'); $lugar = Factory::attributesFor('App\\Lugar', ['lug_abreviatura' => 'asd', 'lug_nombre' => 'asd', 'lug_tipo' => 'pais', 'parent_lug_id' => $padre->lug_id]); $validator = Validator::make($lugar, $this->rules, $this->messages); $this->assertTrue($validator->passes(), 'Se esperaba que falle la validadicon.'); }
public function test_validacion_exitosa_con_formato_de_url() { $clienteFake = factory(App\Cliente::class)->make(); $cliente = Factory::attributesFor('App\\Cliente', ['clt_nombre' => $clienteFake->clt_nombre, 'clt_descripcion' => '', 'clt_dominio' => $clienteFake->clt_dominio]); $validator = Validator::make($cliente, ClienteRequest::$rules, ClienteRequest::$messages); $this->assertTrue($validator->passes(), 'Se esperaba que la validacion de url sea exitosa.'); }
public function test_validacion_exitosa() { $equipo = factory(App\Equipo::class)->create(); $fase = factory(App\Fase::class)->create(); $penalizacion = Factory::attributesFor('App\\PenalizacionTorneo', ['eqp_id' => $equipo->eqp_id, 'fas_id' => $fase->fas_id, 'ptr_puntos' => 1, 'ptr_motivo' => 'asd']); $validator = Validator::make($penalizacion, $this->rules, $this->messages); $this->assertTrue($validator->passes(), 'Se esperaba que la validadicon sea exitosa.'); }
public function test_validacion_falla_por_campos_demasiado_cortos() { $tipoFase = Factory::attributesFor('App\\TipoFase', ['tfa_nombre' => 'as', 'tfa_descripcion' => 'as']); $validator = Validator::make($tipoFase, $this->rules, $this->messages); $this->assertFalse($validator->passes(), 'Se esperaba que falle la validadicon.'); $this->assertTrue($validator->errors()->has('tfa_nombre'), 'Se esperaba que exista la clave tfa_nombre'); $this->assertCount(1, $validator->errors()->get('tfa_nombre'), 'Se esperaba que exista 1 error en la clave tfa_nombre'); $this->assertTrue($validator->errors()->has('tfa_descripcion'), 'Se esperaba que exista la clave tfa_descripcion'); $this->assertCount(1, $validator->errors()->get('tfa_descripcion'), 'Se esperaba que exista 1 error en la clave tfa_descripcion'); $this->assertCount(2, $validator->errors()->all(), 'Se esperaban 2 errores de validacion'); }
public function test_validacion_exitosa() { Factory::create('App\\Lugar', ['lug_id' => 1]); Factory::create('App\\TipoTorneo', ['ttr_id' => 1]); Factory::create('App\\Equipo', ['eqp_id' => 1, 'lug_id' => 1]); Factory::create('App\\Jugador', ['jug_id' => 1, 'jug_nacionalidad' => 1]); Factory::create('App\\Torneo', ['tor_id' => 1, 'lug_id' => 1, 'ttr_id' => 1]); $plantillaTorneo = Factory::attributesFor('App\\PlantillaTorneo', ['plt_numero_camiseta' => 1, 'eqp_id' => 1, 'jug_id' => 1, 'tor_id' => 1]); $validator = Validator::make($plantillaTorneo, $this->rules, $this->messages); $this->assertTrue($validator->passes(), 'Se esperaba que la validadicon sea exitosa.'); }
public function testStoreSuccess() { Input::replace(Factory::attributesFor($this->factory)); Auth::shouldReceive('user')->andReturn((object) array('id' => 1)); $this->mock->shouldReceive('create')->once()->andReturn($this->mock); $this->mock->shouldReceive('slug')->andReturn('foo'); $this->mock->shouldReceive('highestSeriesOrder')->once()->andReturn(1); $this->mock->shouldReceive('uniqueExcept')->twice(); $this->mock->shouldReceive('identify')->once(); $this->mock->shouldReceive('saveRelations')->twice()->andReturn(array(1, 2, 3)); $this->mock->shouldReceive('categories', 'tags')->once()->andReturn($this->mock); $this->mock->shouldReceive('sync')->twice()->andReturn($this->mock); $this->post($this->url); $this->assertRedirectedToRoute($this->route . '.index'); }
public function test_validacion_exitosa() { Factory::create('App\\Lugar'); $jugador = Factory::attributesFor('App\\Jugador', ['jug_id' => '', 'jug_apellido' => 'asp', 'jug_nombre' => 'asp', 'jug_apodo' => 'asp', 'jug_fecha_nacimiento' => '', 'jug_altura' => '', 'jug_sitioweb' => '', 'jug_twitter' => '', 'jug_foto' => '', 'jug_nacionalidad' => '1']); $validator = Validator::make($jugador, JugadorRequest::$rules, JugadorRequest::$messages); // var_dump($validator->errors()); $this->assertTrue($validator->passes(), 'Se esperaba que falle la validadicon.'); }
public function test_validacion_exitoso_con_formato_sitio_web_http_abc_dot_com() { $auspiciante = Factory::attributesFor('App\\Auspiciante', ['aus_nombre' => 'asd', 'aus_sitioweb' => 'http://asd.com', 'aus_imagen' => '']); $validator = Validator::make($auspiciante, AuspicianteRequest::$rules, AuspicianteRequest::$messages); $this->assertCount(1, $validator->errors()->all(), 'Se esperaban 1 error de validacion'); }
public function test_update() { $clienteFake = factory(App\Cliente::class)->make(); $cliente = Factory::attributesFor('App\\Cliente', ['clt_id' => 1, 'clt_nombre' => $clienteFake->clt_nombre, 'clt_descripcion' => $clienteFake->clt_descripcion, 'clt_dominio' => $clienteFake->clt_dominio]); $this->update_actualiza_registro_y_redirecciona_hacia_index($cliente); }
public function test_Update_con_imagenes() { $jugador = Factory::attributesFor('App\\Jugador', ['jug_id' => '1', 'jug_apellido' => 'mic', 'jug_nombre' => 'mic', 'jug_apodo' => '', 'jug_fecha_nacimiento' => '', 'jug_altura' => '', 'jug_sitioweb' => '', 'jug_twitter' => '', 'jug_foto' => $this->imageMock, 'jug_nacionalidad' => '']); $this->modelMock->shouldReceive('reemplazarImagen')->once()->andReturn('/nuevo/path'); $this->update_actualiza_registro_y_redirecciona_hacia_Index($jugador, ['jug_foto' => $this->imageMock]); }
public function test_Update() { $lugar = factory(App\TipoTorneo::class)->make(); $crear = Factory::attributesFor('App\\TipoTorneo', ['ttr_descripcion' => $lugar->ttr_descripcion, 'ttr_nombre' => $lugar->ttr_nombre]); $this->update_actualiza_registro_y_redirecciona_hacia_Index($crear); }
public function test_Update() { $lugar = factory(App\Lugar::class)->make(); $crear = Factory::attributesFor('App\\Lugar', ['lug_abreviatura' => $lugar->lug_abreviatura, 'lug_nombre' => $lugar->lug_nombre, 'lug_tipo' => $lugar->lug_tipo, 'parent_lug_id' => '']); $this->update_actualiza_registro_y_redirecciona_hacia_Index($crear); }
public function test_Update_con_imagenes() { $auspiciante = Factory::attributesFor('App\\Auspiciante', ['aus_nombre' => 'asdf', 'aus_sitioweb' => '', 'aus_imagen' => $this->imageMock]); $this->modelMock->shouldReceive('reemplazarImagen')->once()->andReturn('/nuevo/path'); $this->update_actualiza_registro_y_redirecciona_hacia_Index($auspiciante, ['aus_imagen' => $this->imageMock]); }
public function test_validacion_exitosa_con_formato_de_fecha_yyyy_mm_dd() { $lugar = Factory::create('App\\Lugar'); $tipoTorneo = Factory::create('App\\TipoTorneo'); $torneo = Factory::attributesFor('App\\Torneo', ['tor_nombre' => 'asd', 'tor_anio_referencia' => 1900, 'tor_fecha_inicio' => '2013-10-23', 'tor_fecha_fin' => '2013-10-24', 'tor_tipo_equipos' => 'profesional', 'tor_numero_equipos' => 2, 'lug_id' => $lugar->lug_id, 'ttr_id' => $tipoTorneo->ttr_id]); $validator = Validator::make($torneo, $this->rules, $this->messages); $this->assertTrue($validator->passes(), 'Se esperaba que la validadicon sea exitosa.'); }