initDatabase(); $this->user = (new User())->create([ 'name' => 'lorem', 'password' => '', 'email' => 'foo@bar.batz', 'api_key' => '', ]); $this->newsData = [ 'title' => 'test title', 'text' => 'test text', 'user_id' => $this->user->id ]; } /** * Tests that creating a News item with default values works. * * @return void */ public function testCreateDefault(): void { $news = (new News())->create($this->newsData); $news = $news->find($news->id); $this->assertSame(1, $news->id); $this->assertSame($this->newsData['title'], $news->title); $this->assertSame($this->newsData['text'], $news->text); $this->assertFalse($news->is_meeting); } /** * Tests that creating a News item with all fill values works. * * @return void */ public function testCreate(): void { $news = (new News())->create( $this->newsData + ['is_meeting' => true] ); $news = $news->find($news->id); $this->assertSame(1, $news->id); $this->assertSame($this->newsData['title'], $news->title); $this->assertSame($this->newsData['text'], $news->text); $this->assertTrue($news->is_meeting); } }