PageRenderTime 62ms CodeModel.GetById 18ms RepoModel.GetById 1ms app.codeStats 0ms

/Croogo/Test/Case/Model/Behavior/UrlBehaviorTest.php

https://github.com/kareypowell/croogo
PHP | 78 lines | 60 code | 8 blank | 10 comment | 0 complexity | d68c69cc96131d007faa274823c45f51 MD5 | raw file
  1. <?php
  2. App::uses('Node', 'Nodes.Model');
  3. App::uses('CroogoTestCase', 'Croogo.TestSuite');
  4. class UrlBehaviorTest extends CroogoTestCase {
  5. public $fixtures = array(
  6. 'plugin.users.aco',
  7. 'plugin.users.aro',
  8. 'plugin.users.aros_aco',
  9. 'plugin.blocks.block',
  10. 'plugin.comments.comment',
  11. 'plugin.contacts.contact',
  12. 'plugin.translate.i18n',
  13. 'plugin.settings.language',
  14. 'plugin.menus.link',
  15. 'plugin.menus.menu',
  16. 'plugin.contacts.message',
  17. 'plugin.nodes.node',
  18. 'plugin.meta.meta',
  19. 'plugin.taxonomy.model_taxonomy',
  20. 'plugin.blocks.region',
  21. 'plugin.users.role',
  22. 'plugin.settings.setting',
  23. 'plugin.taxonomy.taxonomy',
  24. 'plugin.taxonomy.term',
  25. 'plugin.taxonomy.type',
  26. 'plugin.taxonomy.types_vocabulary',
  27. 'plugin.users.user',
  28. 'plugin.taxonomy.vocabulary',
  29. );
  30. public $Node = null;
  31. /**
  32. * setUp
  33. *
  34. * @return void
  35. */
  36. public function setUp() {
  37. parent::setUp();
  38. $this->Node = ClassRegistry::init('Nodes.Node');
  39. }
  40. /**
  41. * tearDown
  42. *
  43. * @return void
  44. */
  45. public function tearDown() {
  46. parent::tearDown();
  47. unset($this->Node);
  48. ClassRegistry::flush();
  49. }
  50. public function testSingle() {
  51. $helloWorld = $this->Node->findBySlug('hello-world');
  52. $this->assertEqual($helloWorld['Node']['url'], array(
  53. 'plugin' => 'nodes',
  54. 'controller' => 'nodes',
  55. 'action' => 'view',
  56. 'type' => 'blog',
  57. 'slug' => 'hello-world',
  58. ));
  59. }
  60. public function testMultiple() {
  61. $result = $this->Node->find('all');
  62. $this->assertEqual($result['0']['Node']['url'], array(
  63. 'plugin' => 'nodes',
  64. 'controller' => 'nodes',
  65. 'action' => 'view',
  66. 'type' => $result['0']['Node']['type'],
  67. 'slug' => $result['0']['Node']['slug'],
  68. ));
  69. }
  70. }