Skip to content

Commit a881b86

Browse files
WIP - nodes p4
1 parent 86eb867 commit a881b86

File tree

6 files changed

+103
-5
lines changed

6 files changed

+103
-5
lines changed

Aisel/backend/web/app/Aisel/Kernel/views/edit/field/user.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
type="text"
77
class="form-control"
88
ng-required="true"
9-
ng-model="item.frontenduser.id">
9+
ng-model="item.user.id">
1010
</div>
1111

1212
<div class="form-group">
@@ -17,5 +17,5 @@
1717
type="text"
1818
class="form-control"
1919
ng-required="true"
20-
ng-model="item.frontenduser.email">
20+
ng-model="item.user.email">
2121
</div>

Aisel/backend/web/app/Aisel/Page/controllers/pageReview.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ define(['app'], function (app) {
4747
enableColumnMenu: false,
4848
width: '200'
4949
}, {
50-
name: 'frontenduser.email',
50+
name: 'user.email',
5151
enableColumnMenu: false,
5252
width: '200'
5353
}, {

Aisel/backend/web/app/Aisel/Product/controllers/productReview.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ define(['app'], function (app) {
4747
enableColumnMenu: false,
4848
width: '200'
4949
}, {
50-
name: 'frontenduser.email',
50+
name: 'user.email',
5151
enableColumnMenu: false,
5252
width: '200'
5353
}, {
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Aisel package.
5+
*
6+
* (c) Ivan Proskuryakov
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Aisel\NavigationBundle\Tests\Controller\Admin;
13+
14+
use Aisel\ResourceBundle\Tests\AbstractWebTestCase;
15+
use Aisel\NavigationBundle\Entity\Menu;
16+
17+
/**
18+
* ApiDuplicateParentNodeControllerTest
19+
*
20+
* @author Ivan Proskuryakov <volgodark@gmail.com>
21+
*/
22+
class ApiDuplicateParentNodeControllerTest extends AbstractWebTestCase
23+
{
24+
25+
public function setUp()
26+
{
27+
parent::setUp();
28+
$this->logInBackend();
29+
}
30+
31+
protected function tearDown()
32+
{
33+
parent::tearDown();
34+
}
35+
36+
public function createNode($name)
37+
{
38+
$node = new Menu();
39+
$node->setLocale('en');
40+
$node->setMetaUrl('/');
41+
$node->setName($name);
42+
$node->setStatus(true);
43+
$this->em->persist($node);
44+
$this->em->flush();
45+
46+
return $node;
47+
}
48+
49+
public function testCascadeUpdateAction()
50+
{
51+
$this->markTestSkipped('JMS should not update parent values');
52+
53+
$child = $this->createNode('Child');
54+
$parent = $this->createNode('Parent');
55+
56+
$data = [
57+
'parent' => [
58+
'id' => $parent->getId(),
59+
'status' => false,
60+
'name' => $this->faker->randomNumber(),
61+
'meta_url' => $this->faker->randomNumber()
62+
],
63+
];
64+
65+
$this->client->request(
66+
'PUT',
67+
'/' . $this->api['backend'] . '/navigation/' . $child->getId(),
68+
[],
69+
[],
70+
['CONTENT_TYPE' => 'application/json'],
71+
json_encode($data)
72+
);
73+
74+
75+
$response = $this->client->getResponse();
76+
$content = $response->getContent();
77+
$statusCode = $response->getStatusCode();
78+
$result = json_decode($content, true);
79+
80+
$this->assertEmpty($content);
81+
$this->assertTrue(204 === $statusCode);
82+
83+
$this->em->clear();
84+
85+
$node = $this
86+
->em
87+
->getRepository('Aisel\NavigationBundle\Entity\Menu')
88+
->findOneBy(['id' => $child->getId()]);
89+
90+
$this->assertEquals($parent->getId(), $node->getParent()->getId());
91+
$this->assertEquals($child->getId(), $node->getParent()->getChildren()[0]->getId());
92+
$this->assertEquals($node->getParent()->getName(), $data['parent']['name']);
93+
$this->assertEquals($node->getParent()->getStatus(), $data['parent']['status']);
94+
$this->assertEquals($node->getParent()->getMetaUrl(), $data['parent']['meta_url']);
95+
}
96+
97+
}

Aisel/src/Aisel/NavigationBundle/Tests/Controller/Admin/ApiNodeControllerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public function createNode($name)
3939
$node->setLocale('en');
4040
$node->setMetaUrl('/');
4141
$node->setName($name);
42-
$node->setStatus($name);
42+
$node->setStatus(true);
4343
$this->em->persist($node);
4444
$this->em->flush();
4545

Aisel/src/Aisel/ReviewBundle/Entity/Review.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ abstract class Review
5151
* @ORM\JoinColumn(name="user_id", referencedColumnName="id")
5252
* @JMS\Type("Aisel\UserBundle\Entity\User")
5353
* @JMS\Expose
54+
* @JMS\ReadOnly
5455
* @JMS\MaxDepth(2)
5556
* @JMS\Groups({"collection","details"})
5657
*/

0 commit comments

Comments
 (0)