Skip to content

Commit

Permalink
add unit test for case when album is null
Browse files Browse the repository at this point in the history
  • Loading branch information
BernhardPosselt committed Sep 9, 2013
1 parent d102d36 commit b4e4dd2
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/php/unit/db/albumMapperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,18 @@ public function testFindByNameAndYear(){
$this->assertEquals($this->albums[0], $result);
}

public function testFindByNameAndYearYearIsNull(){
$sql = 'SELECT `album`.`name`, `album`.`year`, `album`.`id`, '.
'`album`.`cover` '.
'FROM `*PREFIX*music_albums` `album` '.
'WHERE `album`.`user_id` = ? AND `album`.`name` = ? AND `album`.`year` IS NULL';
$albumName = 'test';
$albumYear = null;
$this->setMapperResult($sql, array($this->userId, $albumName), array($this->rows[0]));
$result = $this->mapper->findByNameAndYear($albumName, $albumYear, $this->userId);
$this->assertEquals($this->albums[0], $result);
}

public function testAddAlbumArtistRelationIfNotExistNoAdd(){
$sql = 'SELECT 1 FROM `*PREFIX*music_album_artists` `relation` '.
'WHERE `relation`.`album_id` = ? AND `relation`.`artist_id` = ?';
Expand Down

0 comments on commit b4e4dd2

Please sign in to comment.