コード例 #1
0
ファイル: ExampleTest.php プロジェクト: sabahtalateh/laracast
 /**
  * @test
  */
 function it_gets_the_total_length_of_all_songs_in_album()
 {
     // given
     $artist = Factory::create(Artist::class);
     $album = Factory::create(Album::class, ['artist_id' => $artist->id]);
     Factory::times(3)->create(Song::class, ['album_id' => $album->id, 'length' => 200]);
     // when
     $album = Album::first();
     $length = $album->getTotalLength();
     // then
     $this->assertEquals(600, $length);
 }
コード例 #2
0
ファイル: DownloadTest.php プロジェクト: Hebilicious/koel
 public function testAlbum()
 {
     $album = Album::first();
     $mocked = Download::shouldReceive('from')->once()->andReturn($this->mediaPath . '/blank.mp3');
     $this->get("api/download/album/{$album->id}")->seeStatusCode(200);
 }