Skip to content
Snippets Groups Projects
RechercheControllerAlbum1DTouchTest.php 3.89 KiB
Newer Older
<?php
/**
 * Copyright (c) 2012-2014, Agence Française Informatique (AFI). All rights reserved.
 *
 * BOKEH is free software; you can redistribute it and/or modify
 * it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by
 * the Free Software Foundation.
 *
 * There are special exceptions to the terms and conditions of the AGPL as it
 * is applied to this software (see README file).
 *
 * BOKEH is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
 *
 * You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
 * along with BOKEH; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA
 */

abstract class RechercheControllerAlbum1DTouchTestCase extends AbstractControllerTestCase {
  protected $_storm_default_to_volatile = true;

  public function setUp() {
    parent::setUp();

    $this->_prepareFixtures();
    $bridges = $this->fixture('Class_Album',
                   ['id' => 74721,
                    'titre' => 'Bridges',
                    'date_maj' => '2015-06-22 16:55:37',
                    'type_doc_id' => 114,
                    'id_langue' => 'fre',
                    'id_origine' => 1,
                    'notes' => 'a:7:{i:0;a:2:{s:5:"field";s:3:"701";s:4:"data";a:2:{s:1:"a";s:5:"Eivor";i:4;s:0:"";}}i:1;a:2:{s:5:"field";s:3:"856";s:4:"data";a:2:{s:1:"x";s:6:"poster";s:1:"a";s:88:"https://commondatastorage.googleapis.com/music-production/cargo/medium_0663993761558.jpg";}}i:2;a:2:{s:5:"field";s:3:"856";s:4:"data";a:2:{s:1:"x";s:12:"external_uri";s:1:"a";s:33:"http://music.1dtouch.com/albums/1";}}i:3;a:2:{s:5:"field";s:3:"856";s:4:"data";a:2:{s:1:"x";s:6:"poster";s:1:"a";s:88:"https://commondatastorage.googleapis.com/music-production/cargo/medium_0663993761558.jpg";}}i:4;a:2:{s:5:"field";s:3:"856";s:4:"data";a:2:{s:1:"x";s:12:"external_uri";s:1:"a";s:33:"http://music.1dtouch.com/albums/1";}}i:5;a:2:{s:5:"field";s:3:"856";s:4:"data";a:2:{s:1:"x";s:6:"poster";s:1:"a";s:88:"https://commondatastorage.googleapis.com/music-production/cargo/medium_0663993761558.jpg";}}i:6;a:2:{s:5:"field";s:3:"856";s:4:"data";a:2:{s:1:"x";s:12:"external_uri";s:1:"a";s:33:"http://music.1dtouch.com/albums/1";}}}',
                    'url_origine' => 'http://export.1dtouch.com/oai',
                    'visible' => 1,
                    'status' => 3]);
    $bridges->index();

    $this->dispatch('/opac/noticeajax/detail/id/' . $bridges->getNoticeId(), true);
  }


  protected function _prepareFixtures() {

  }


  /** @test */
  public function authorShouldBePresent() {
    $this->assertXPathContentContains('//a[contains(@href, "/code_rebond/A1")]', 'Eivor');
  }
class RechercheControllerAlbum1DTouchWithSSOTest
  extends RechercheControllerAlbum1DTouchTestCase {

  protected function _prepareFixtures() {
    $this->fixture('Class_AdminVar',
                   ['id' => 'ONEDTOUCH_ID',
                    'clef' => 'ONEDTOUCH_ID',
                    'valeur' => 'my_bib']);
  }


  /** @test */
  public function externalUrlShouldBeSSO() {
    $this->assertXPathContentContains('//a[@href="http://music.1dtouch.com/users/auth/my_bib?dest=albums/1"]',
                                      'l\'album sur 1DTouch');
  }
}




class RechercheControllerAlbum1DTouchWithoutSSOTest
  extends RechercheControllerAlbum1DTouchTestCase {

  protected function _prepareFixtures() {
    $this->fixture('Class_AdminVar',
                   ['id' => 'ONEDTOUCH_ID',
                    'clef' => 'ONEDTOUCH_ID',
                    'valeur' => '']);
  }
  public function externalUrlShouldBeSSO() {
    $this->assertXPathContentContains('//a[@href="http://music.1dtouch.com/albums/1"]',
                                      'l\'album sur 1DTouch');