/**
  * @dataProvider moveSetMultiColumnProvider
  */
 public function testMoveSetMultiColumn($origin_email, $album_id, $destination_email, $position, $origin_resulting_order, $destination_resulting_order)
 {
     $origin_fa = new FavoriteAlbum(array('email' => $origin_email, 'album_id' => $album_id));
     $origin_fa->setEmail($destination_email);
     if ($position) {
         $origin_fa->setPosition($position);
     }
     $origin_fa->store();
     $expected_origin_result = array();
     foreach ($origin_resulting_order as $index => $album_id) {
         $expected_origin_result[] = array('email' => $origin_email, 'position' => $index + 1, 'album_id' => $album_id);
     }
     $actual_origin_result = self::$db->translatedQuery("SELECT email, position, album_id FROM favorite_albums WHERE email = %s ORDER BY position ASC", $origin_email)->fetchAllRows();
     $this->assertEquals($expected_origin_result, $actual_origin_result);
     $expected_destination_result = array();
     foreach ($destination_resulting_order as $index => $album_id) {
         $expected_destination_result[] = array('email' => $destination_email, 'position' => $index + 1, 'album_id' => $album_id);
     }
     $actual_destination_result = self::$db->translatedQuery("SELECT email, position, album_id FROM favorite_albums WHERE email = %s ORDER BY position ASC", $destination_email)->fetchAllRows();
     $this->assertEquals($expected_destination_result, $actual_destination_result);
 }
Ejemplo n.º 2
0
 public function testSwappedMultiColumnConstruct()
 {
     $album = new FavoriteAlbum(array('album_id' => 1, 'email' => '*****@*****.**'));
     $this->assertEquals('*****@*****.**', $album->getEmail());
     $this->assertEquals(2, $album->getPosition());
 }