Skip to content

Commit

Permalink
Merge pull request KnpLabs#74 from dantleech/pwf_fix
Browse files Browse the repository at this point in the history
Pwf fix closes KnpLabs#73
  • Loading branch information
dantleech committed Jun 18, 2013
2 parents 9cf1077 + ddbd052 commit db23634
Show file tree
Hide file tree
Showing 14 changed files with 30 additions and 12 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Tests/Functional/App/cache
Tests/Functional/App/logs
Tests/Resources/app/cache
Tests/Resources/app/logs
composer.lock
vendor
6 changes: 3 additions & 3 deletions Document/MenuNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,17 +92,17 @@ class MenuNode implements NodeInterface, PublishWorkflowInterface
protected $routeParameters = array();

/**
* @PHPCRODM\Boolean()
* @var boolean
*/
protected $publishable = true;

/**
* @PHPCRODM\Date()
* @var \DateTime
*/
protected $publishStartDate;

/**
* @PHPCRODM\Date()
* @var \DateTime
*/
protected $publishEndDate;

Expand Down
4 changes: 4 additions & 0 deletions Resources/config/doctrine/MenuNode.phpcr.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@

<field name="weak" type="boolean"/>

<field name="publishable" type="boolean"/>
<field name="publishStartDate" type="date"/>
<field name="publishEndDate" type="date"/>

<field name="attributes" type="string" assoc=""/>
<field name="childrenAttributes" type="string" assoc=""/>
<field name="extras" type="string" multivalue="true" assoc=""/>
Expand Down
4 changes: 0 additions & 4 deletions Tests/Functional/App/config/config.php

This file was deleted.

12 changes: 12 additions & 0 deletions Tests/Functional/Document/MenuNodeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ public function testMenuNode()
'route' => 'foo_route',
'weakContent' => $this->weakContent,
'hardContent' => $this->hardContent,
'publishable' => false,
'publishStartDate' => new \DateTime('2013-06-18'),
'publishEndDate' => new \DateTime('2013-06-18'),
'attributes' => array(
'attr_foobar_1' => 'barfoo',
'attr_foobar_2' => 'barfoo',
Expand Down Expand Up @@ -108,5 +111,14 @@ public function testMenuNode()

// test children
$this->assertCount(1, $menuNode->getChildren());

// test publish start and end
$publishStartDate = $data['publishStartDate'];
$publishEndDate = $data['publishEndDate'];

$this->assertInstanceOf('\DateTime', $publishStartDate);
$this->assertInstanceOf('\DateTime', $publishEndDate);
$this->assertEquals($data['publishStartDate']->format('Y-m-d'), $publishStartDate->format('Y-m-d'));
$this->assertEquals($data['publishEndDate']->format('Y-m-d'), $publishEndDate->format('Y-m-d'));
}
}
2 changes: 1 addition & 1 deletion Tests/Functional/Document/MultilangMenuNodeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function testMenuNode()
$this->dm->flush();
$this->dm->clear();

$menuNode = $this->dm->find(null, '/test/test-node');
$menuNode = $this->dm->findTranslation(null, '/test/test-node', 'fr');
$this->assertEquals('fr', $menuNode->getLocale());
}
}
File renamed without changes.
File renamed without changes.
6 changes: 6 additions & 0 deletions Tests/Resources/app/config/config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?php

$loader->import(CMF_TEST_CONFIG_DIR.'/default.php');
$loader->import(CMF_TEST_CONFIG_DIR.'/phpcr_odm.php');
$loader->import(CMF_TEST_CONFIG_DIR.'/sonata_admin.php');
$loader->import(__DIR__.'/cmf_menu.yml');
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public function testPublishWorkflowInterface()
$this->assertNull($n->getPublishStartDate());
$this->assertNull($n->getPublishEndDate());

$n->setIsPublishable(false);
$n->setPublishable(false);
$n->setPublishStartDate($startDate);
$n->setPublishEndDate($endDate);

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
</filter>

<php>
<server name="KERNEL_DIR" value="Tests/Functional/App" />
<server name="KERNEL_DIR" value="Tests/Resources/app" />
</php>

</phpunit>

0 comments on commit db23634

Please sign in to comment.