Newer
Older
$this->assertXpath('//div[@class="reseaux-sociaux"][contains(@data-article-url, "cms/reseau/id_article/224")]/img[contains(@src, "patience.gif")]');
}
/** @test */
public function initializeResauxSociauxScriptShouldBePresent() {
$this->assertXPathContentContains('//script',
"initializeReseauxSociaux");
}
/** @test */
public function contentShouldBePresent() {
$this->assertXpathContentContains('//div[@class="contenu"]', 'Une fête appétissante');
}
/** @test */
function withLanguageEnShouldReturnEnglishTranslation() {
$this->bootstrap();
$this->dispatch('/cms/articleview/id/224/language/en');
$this->assertXpathContentContains('//h1', 'Feast of fried');
}
/** @test */
function withLanguageEnEventDateShouldBeTranslated() {
$this->bootstrap();
$this->dispatch('/cms/articleview/id/224/language/en');
$this->assertXpathContentContains('//span[@class="calendar_event_date"]',
'From Saturday 03 September to Wednesday 05 October 2011',
$this->_response->getBody());
}
/** @test */
function withCurrentLocaleEnShouldReturnEnglishTranslation() {
$this->bootstrap();
Zend_Registry::get('session')->language = 'en';
$this->dispatch('/cms/articleview/id/224');
$this->assertXpathContentContains('//h1', 'Feast of fried');
}
/** @test */
public function avisArgShouldNotHaveLinkForDeletion() {
$this->assertNotXPath('//a[contains(@href, "admin/modo/delete-cms-avis/id/35")]');
}
/** @test */
function divShouldContainsAdresseBonlieu() {
$this->assertXPathContentContains('//div[@class="lieu"]', 'Annecy');
}
/** @test */
function divShouldContainsGoogleMap() {
$this->assertXPath('//div[@class="lieu"]//img[contains(@src,"http://maps.googleapis.com/maps")]');
}
/** @test */
public function readSpeakerLinkShouldBePresent() {
$this->assertXPath('//a[@class="readspeaker"][contains(@onclick, "/cms/articleread?id=224")]',
$this->_response->getBody());
}
/** @test */
public function speakStartMarkerShouldBePresent() {
$this->assertXpathContentContains('//article[@class="auto_resize article"]', '<!-- RSPEAK_START -->');
}
/** @test */
public function speakStopMarkerShouldBePresent() {
$this->assertXpathContentContains('//article[@class="auto_resize article"]', '<!-- RSPEAK_STOP -->');
}
}
class CmsControllerArticleViewArticleArchivedWithWorkflowTest extends CmsControllerWithFeteDeLaFriteTestCase {
protected function _loginHook($account) {
$account->ROLE_LEVEL = ZendAfi_Acl_AdminControllerRoles::ABONNE_SIGB;
$account->PSEUDO = "admin";
}
Class_AdminVar::newInstanceWithId('WORKFLOW', ['valeur' => '1']);
/** @test */
public function responseShouldBeA404NotFound() {
$this->assertResponseCode(404);
}
/** @test */
public function pageShouldContainsH1WithNotFound() {
$this->assertXPathContentContains('//h1', 'Désolé, cette page n\'existe pas');
}
/** @test */
public function articleTitleShouldNotBeVisible() {
$this->assertNotXPathContentContains('//h1', 'frite');
}
}
class CmsControllerArticleViewArticleArchivedWithWorkflowAsModoBibTest extends CmsControllerWithFeteDeLaFriteTestCase {
protected function _loginHook($account) {
$account->ROLE_LEVEL = ZendAfi_Acl_AdminControllerRoles::MODO_BIB;
$account->PSEUDO = "redac";
}
Class_AdminVar::newInstanceWithId('WORKFLOW', ['valeur' => '1']);
/** @test */
public function responseShouldNotBeA404NotFound() {
$this->assertNotResponseCode(404);
}
/** @test */
public function articleTitleShouldBeVisible() {
$this->assertXPathContentContains('//h1', 'frite');
}
}
class CmsControllerArticleViewAsAdminTest extends CmsControllerWithFeteDeLaFriteTestCase {
protected function _loginHook($account) {
$account->ROLE_LEVEL = ZendAfi_Acl_AdminControllerRoles::ADMIN_PORTAIL;
$account->PSEUDO = "admin";
}
public function setUp() {
parent::setUp();
$this->dispatch('/cms/articleview/id/224', true);
}
/** @test */
public function avisShouldContainsEnteteArgg() {
$this->assertXPathContentContains('//table[@class="avis"]//td', 'Argg',$this->_response->getBody());
}
/** @test */
public function avisFlorenceShouldHaveParFlorence() {
$this->assertXPathContentContains('//div', 'par : <b>Florence</b>');
}
/** @test */
public function avisShouldContainsEnteteHmmm() {
$this->assertXPathContentContains('//table[@class="avis"]//td', 'Hmmm');
}
/** @test */
public function avisShouldContainsEnteteAnonyme() {
$this->assertXPathContentContains('//table[@class="avis"]//td', 'Anonyme');
}
/** @test */
public function avisHmmShouldHaveLinkForDeletion() {
$this->assertXPath('//table[@class="avis"]//td[contains(text(), "Hmmm")]//a[contains(@href, "admin/modo/delete-cms-avis/id/34")]');
}
/** @test */
public function avisArgShouldHaveLinkForDeletion() {
$this->assertXPath('//table[@class="avis"]//td[contains(text(), "Argg")]//a[contains(@href, "admin/modo/delete-cms-avis/id/35")]');
}
/** @test */
public function tagEditArticleShouldBeVisible() {
$this->assertXPath('//a[contains(@href, "/admin/cms/edit/id/224")]');
}
class CmsControllerArticleViewWithModoTest extends CmsControllerWithFeteDeLaFriteTestCase {
Class_AdminVar::getLoader()
->newInstanceWithId('MODO_AVIS_BIBLIO')
->setValeur(1);
Class_AdminVar::getLoader()
->newInstanceWithId('MODO_AVIS')
->setValeur(1);
$this->dispatch('/cms/articleview/id/224', true);
}
/** @test */
public function avisNotShouldContainsEnteteArgg() {
$this->assertNotXPathContentContains('//table[@class="avis"]//td', 'Argg');
}
/** @test */
public function avisNotShouldContainsEnteteHmmm() {
$this->assertNotXPathContentContains('//table[@class="avis"]//td', 'Hmmm');
}
}
class CmsControllerArticleReadTest extends CmsControllerWithFeteDeLaFriteTestCase {
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
public function setUp() {
parent::setUp();
$this->dispatch('/cms/articleread/id/224', true);
}
/** @test */
public function speakStartMarkerShouldBePresent() {
$this->assertXpathContentContains('//article[@class="auto_resize article"]', '<!-- RSPEAK_START -->');
}
/** @test */
public function speakStopMarkerShouldBePresent() {
$this->assertXpathContentContains('//article[@class="auto_resize article"]', '<!-- RSPEAK_STOP -->');
}
/** @test */
function withLanguageEnArticleReadShouldReturnEnglishTranslation() {
$this->bootstrap();
$this->dispatch('/cms/articleread/id/224/language/en', true);
$this->assertXpathContentContains('//h1', 'Feast of fried');
}
abstract class CmsControllerListTestCase extends AbstractControllerTestCase {
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
/**
* @return array
*/
protected function _createFeteDeLaFriteAndMatsumotoArticles() {
return array(
Class_Article::newInstanceWithId(224)
->setTitre('La fête de la frite')
->setDescription('Ce soir ça frite !')
->setContenu('<div>Une fête appétissante</div>'),
Class_Article::newInstanceWithId(225)
->setTitre('Dédicaces de Leiji Matsumoto sama')
->setContenu('<div>Albaaaaaator, albaaaator</div>')
);
}
/**
* Used to choose which action to dispatch
*/
protected function _dispatchHook() {}
public function setUp() {
parent::setUp();
Storm_Test_ObjectWrapper::onLoaderOfModel('Class_Article')
->whenCalled('getArticlesByPreferences')
->answers($this->_createFeteDeLaFriteAndMatsumotoArticles())
->getWrapper()
->whenCalled('filterByLocaleAndWorkflow')
->with($this->_createFeteDeLaFriteAndMatsumotoArticles())
->answers($this->_createFeteDeLaFriteAndMatsumotoArticles());
$this->_dispatchHook();
}
/** @test */
public function feteDeLaFriteShouldBePresent() {
$this->assertXpathContentContains('//h1', 'La fête de la frite');
}
/** @test */
public function dedicaceMatsumotoShouldBePresent() {
$this->assertXpathContentContains('//h1', 'Dédicaces de Leiji Matsumoto sama');
}
/** @test */
public function workflowAndTranslationFilterShouldBeCalled() {
$this->assertTrue(
Class_Article::getLoader()->methodHasBeenCalled('filterByLocaleAndWorkflow')
);
}
class CmsControllerArticleViewRecentTest extends CmsControllerListTestCase {
protected function _dispatchHook() {
$this->dispatch('/cms/articleviewrecent/nb/2');
}
class CmsControllerViewSummaryTest extends CmsControllerListTestCase {
protected function _dispatchHook() {
$this->dispatch('/cms/viewsummary');
}
class CmsControllerArticleViewSelectionTest extends CmsControllerListTestCase {
protected function _dispatchHook() {
$this->dispatch('/cms/articleviewselection');
}
public function setUp() {
parent::setUp();
$this->preferences = Class_Article::getLoader()->getFirstAttributeForLastCallOn('getArticlesByPreferences');
}
/** @test */
public function nbAffShouldBeThirty() {
$this->assertEquals(30, $this->preferences['nb_aff']);
}
/** @test */
public function orderShouldBeDatePublicationDesc() {
$this->assertEquals('Selection', $this->preferences['display_order']);
}
class CmsControllerArticleViewSelectionRssBrokenLinkForwardTest extends CmsControllerArticleViewSelectionTest {
// forward to prevent broken link on rss, tix #25724
protected function _dispatchHook() {
$this->dispatch('/cms/viewselection');
}
class CmsControllerArticleViewSelectionFromHorizontalMenuBoxTest extends AbstractControllerTestCase {
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
public function setUp() {
parent::setUp();
$cfg_menus = ['H' => ['libelle' => 'Menu horizontal',
'picto' => 'vide.gif',
'menus' => [['type_menu' => 'MENU',
'libelle' => 'Pratique',
'picto' => 'bookmark.png',
'preferences' => [],
'sous_menus' => [
['type_menu' => 'NEWS',
'libelle' => 'Nouvelles',
'picto' => 'vide.gif',
'preferences' => ['titre' => 'Nouvelles',
'id_items' => 2,
'display_order' => 'Selection']]
]
]]
]];
$this->fixture('Class_Profil',
['id' => 3,
'libelle' => 'Concerts',
'cfg_menus' => $cfg_menus])->beCurrentProfil();
$article = $this->fixture('Class_Article',
['id' => 2,
'titre' => 'Ibrahim Maalouf',
'contenu' => 'En concert !']);
Storm_Test_ObjectWrapper::onLoaderOfModel('Class_Article')
->whenCalled('getArticlesByPreferences')
->with(['titre' => 'Nouvelles',
'id_items' => 2,
'display_order' => 'Selection',
'nb_aff' => 30])
->answers([$article]);
$this->dispatch('/cms/articleviewselection/id_module/1/id_menu/H', true);
}
/** @test */
public function pageShouldRenderArticleIbrahimMaalouf() {
$this->assertXPathContentContains('//div', 'Ibrahim Maalouf');
}
}
class CmsControllerArticleViewPreferencesBySelectionTest extends CmsControllerListTestCase {
protected function _dispatchHook() {
$this->dispatch('/cms/articleviewpreferences?id_items=1-3&display_order=Selection');
}
public function setUp() {
parent::setUp();
$this->preferences = Class_Article::getLoader()->getFirstAttributeForLastCallOn('getArticlesByPreferences');
}
/** @test */
public function itemsShouldBeOneAndThree() {
$this->assertEquals('1-3', $this->preferences['id_items']);
}
/** @test */
public function orderShouldBeDatePublicationDesc() {
$this->assertEquals('Selection', $this->preferences['display_order']);
}
/** @test */
public function aDivShouldContainsUneFeteAppetissante() {
$this->assertXPathContentContains('//div', 'Une fête appétissante');
}
/** @test */
public function noDivShouldContainsCeSoirCaFrite() {
$this->assertNotXPathContentContains('//div', 'Ce soir ça frite !');
}
}
class CmsControllerArticleViewPreferencesSummaryTest extends CmsControllerListTestCase {
protected function _dispatchHook() {
$this->dispatch('/cms/articleviewpreferences?id_items=1-3&display_order=Selection&display_mode=Summary&summary_content=Summary');
}
/** @test */
public function noDivShouldContainsUneFeteAppetissante() {
$this->assertNotXPathContentContains('//div', 'Une fête appétissante');
}
/** @test */
public function aDivShouldContainsCeSoirCaFrite() {
$this->assertXPathContentContains('//div', 'Ce soir ça frite !');
}
/** @test */
public function linkLireArticleCompleShouldBePresent() {
$this->assertXPathContentContains('//a[contains(@href, "/cms/articleview/id/224")]',
"Lire l'article complet");
}
}
class CmsControllerArticleViewPreferencesSummaryWithoutDisplayModeTest extends CmsControllerListTestCase {
protected function _dispatchHook() {
$this->dispatch('/cms/articleviewpreferences?id_items=1-3&display_order=Selection&summary_content=Summary');
}
/** @test */
public function aDivShouldContainsUneFeteAppetissante() {
$this->assertXPathContentContains('//div', 'Une fête appétissante');
}
/** @test */
public function noDivShouldContainsCeSoirCaFrite() {
$this->assertNotXPathContentContains('//div', 'Ce soir ça frite !');
}
class CmsControllerCategorieViewTest extends CmsControllerListTestCase {
protected function _dispatchHook() {
$this->dispatch('/cms/categorieview');
}