Example #1
0
 /** @test */
 public function it_can_update_a_motion()
 {
     $motion = postMotion($this);
     // Update Motion
     $closing = createClosingDate();
     $updated = factory(App\Motion::class, 'as_this_user')->make()->toArray();
     $updated = array_merge($updated, createClosingDate());
     $updated = $this->call('PATCH', '/api/motion/' . $motion->id . '?token=' . $this->token, $updated);
     $updated = $updated->getOriginalContent();
     $this->assertResponseOk();
     $this->seeInDatabase('motions', ['title' => $updated->title, 'summary' => $updated->summary, 'closing' => $closing]);
 }
Example #2
0
function postMotion($self, $attributes = [])
{
    if (!$self) {
        return factory(App\Motion::class)->create();
    }
    $motion = factory(App\Motion::class, 'as_this_user')->make()->toArray();
    $attributes = array_merge($attributes, createClosingDate());
    if ($attributes) {
        $motion = array_merge($motion, $attributes);
    }
    $motion = $self->call('POST', '/api/motion?token=' . $self->token, $motion);
    $self->assertResponseOk();
    return $motion->getOriginalContent();
}