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 006b3a0
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 5 deletions.
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
2 changes: 1 addition & 1 deletion Tests/Document/MenuNodeTest.php
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
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());
}
}

0 comments on commit 006b3a0

Please sign in to comment.