コード例 #1
0
 /**
  * @test
  */
 public function canRegisterAFamilyAsGuestWithFees()
 {
     $this->simulateTransaction();
     $shirtSize = 'XL';
     $tournament = Tournament::firstOrFail();
     $playerFirstName = 'Mark';
     $firstName = 'John';
     $lastName = 'Smith';
     $email = 'testuser' . time() . '@example.com';
     $street = '123 Test Street';
     $spouseFirstName = 'apples';
     $this->visit('/tournaments/' . $tournament->slug . '/registration/spectator')->type($firstName, 'first_name')->type($lastName, 'last_name')->type($email, 'email')->press('Continue')->see('The street address field is required')->see('The zip code field is required')->type($street, 'address_one')->type('12345', 'zip_code')->select($shirtSize, 'shirt_size')->type($spouseFirstName, 'spouse_first_name')->type($playerFirstName, 'minor[1][first_name]')->press('Continue')->seePageIs('/cart')->see('Family Tournament Registration')->press('Submit')->see('Your registration is complete');
     $spectator = Spectator::orderBy('id', 'desc')->first();
     $this->assertEquals($shirtSize, $spectator->shirt_size);
     // defaults to no group selected
     $this->assertNull($spectator->group_id);
     $this->assertEquals($firstName, $spectator->first_name);
     $this->assertEquals($lastName, $spectator->last_name);
     $this->assertEquals($email, $spectator->email);
     $this->assertEquals($spouseFirstName, $spectator->spouse_first_name);
     // we use the receipt_id to determine if payment has been made
     $this->assertGreaterThan(0, $spectator->receipt_id);
     // verify address is populated
     $this->assertEquals($street, $spectator->address->address_one);
     // assert minor is there
     $this->assertEquals($playerFirstName, $spectator->minors()->first()->name);
 }
コード例 #2
0
 /**
  * @return Spectator
  */
 public function spectator()
 {
     return Spectator::where('id', $this->eventData()[0])->first();
 }