/Croogo/Test/Case/Model/Behavior/UrlBehaviorTest.php
PHP | 78 lines | 60 code | 8 blank | 10 comment | 0 complexity | d68c69cc96131d007faa274823c45f51 MD5 | raw file
- <?php
- App::uses('Node', 'Nodes.Model');
- App::uses('CroogoTestCase', 'Croogo.TestSuite');
- class UrlBehaviorTest extends CroogoTestCase {
- public $fixtures = array(
- 'plugin.users.aco',
- 'plugin.users.aro',
- 'plugin.users.aros_aco',
- 'plugin.blocks.block',
- 'plugin.comments.comment',
- 'plugin.contacts.contact',
- 'plugin.translate.i18n',
- 'plugin.settings.language',
- 'plugin.menus.link',
- 'plugin.menus.menu',
- 'plugin.contacts.message',
- 'plugin.nodes.node',
- 'plugin.meta.meta',
- 'plugin.taxonomy.model_taxonomy',
- 'plugin.blocks.region',
- 'plugin.users.role',
- 'plugin.settings.setting',
- 'plugin.taxonomy.taxonomy',
- 'plugin.taxonomy.term',
- 'plugin.taxonomy.type',
- 'plugin.taxonomy.types_vocabulary',
- 'plugin.users.user',
- 'plugin.taxonomy.vocabulary',
- );
- public $Node = null;
- /**
- * setUp
- *
- * @return void
- */
- public function setUp() {
- parent::setUp();
- $this->Node = ClassRegistry::init('Nodes.Node');
- }
- /**
- * tearDown
- *
- * @return void
- */
- public function tearDown() {
- parent::tearDown();
- unset($this->Node);
- ClassRegistry::flush();
- }
- public function testSingle() {
- $helloWorld = $this->Node->findBySlug('hello-world');
- $this->assertEqual($helloWorld['Node']['url'], array(
- 'plugin' => 'nodes',
- 'controller' => 'nodes',
- 'action' => 'view',
- 'type' => 'blog',
- 'slug' => 'hello-world',
- ));
- }
- public function testMultiple() {
- $result = $this->Node->find('all');
- $this->assertEqual($result['0']['Node']['url'], array(
- 'plugin' => 'nodes',
- 'controller' => 'nodes',
- 'action' => 'view',
- 'type' => $result['0']['Node']['type'],
- 'slug' => $result['0']['Node']['slug'],
- ));
- }
- }