-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Retire dead code, add test of device edit.
- Loading branch information
Showing
3 changed files
with
41 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
|
||
namespace Tests\Feature; | ||
|
||
use App\Device; | ||
use App\Party; | ||
use App\User; | ||
use DB; | ||
use Tests\TestCase; | ||
|
||
class EditTest extends TestCase | ||
{ | ||
protected function setUp(): void | ||
{ | ||
parent::setUp(); | ||
|
||
$this->event = factory(Party::class)->create(); | ||
$this->admin = factory(User::class)->state('Administrator')->create(); | ||
$this->device_inputs = factory(Device::class)->raw([ | ||
'event_id' => $this->event->idevents, | ||
'quantity' => 1, | ||
]); | ||
$this->actingAs($this->admin); | ||
|
||
$this->withoutExceptionHandling(); | ||
} | ||
|
||
public function testEdit() | ||
{ | ||
$rsp = $this->post('/device/create', $this->device_inputs); | ||
self::assertTrue($rsp['success']); | ||
$iddevices = $rsp['devices'][0]['iddevices']; | ||
self::assertNotNull($iddevices); | ||
|
||
# Edit the quantity. | ||
$atts = $this->device_inputs; | ||
$atts['quantity'] = 2; | ||
$rsp = $this->post('/device/edit/' . $iddevices, $atts); | ||
self::assertEquals('Device updated!', $rsp['success']); | ||
} | ||
} |