Failed Conditions
Pull Request — 2.6 (#7149)
by
unknown
08:58
created
tests/Doctrine/Tests/ORM/Functional/Ticket/DDC6470Test.php 2 patches
Indentation   +155 added lines, -155 removed lines patch added patch discarded remove patch
@@ -16,59 +16,59 @@  discard block
 block discarded – undo
16 16
  */
17 17
 class DDC6470Test extends \Doctrine\Tests\OrmFunctionalTestCase
18 18
 {
19
-	public function setUp()
20
-	{
21
-		$this->enableSecondLevelCache();
22
-		parent::setUp();
23
-
24
-		try {
25
-			$this->setUpEntitySchema([
26
-				DDC6470Source::class,
27
-				DDC6470Target::class,
28
-			]);
29
-		} catch (SchemaException $e) {
30
-		}
31
-	}
32
-
33
-	/**
34
-	 * @throws \Doctrine\Common\Persistence\Mapping\MappingException
35
-	 * @throws \Doctrine\ORM\ORMException
36
-	 * @throws \Doctrine\ORM\OptimisticLockException
37
-	 */
38
-	public function testOneToOne()
39
-	{
40
-		$source = new DDC6470Source();
41
-		$target = new DDC6470Target();
42
-		$source->setTarget($target);
43
-
44
-		$this->_em->persist($source);
45
-		$this->_em->flush();
46
-		$this->_em->clear();
47
-
48
-		$this->assertTrue($this->_em->getCache()->containsEntity(DDC6470Source::class, ['id' => $source->getId()]));
49
-		$this->assertTrue($this->_em->getCache()->containsEntity(DDC6470Target::class, ['id' => $target->getId()]));
50
-
51
-		$queryCount = $this->getCurrentQueryCount();
52
-
53
-		/** @var EntityRepository $er */
54
-		$er = $this->_em->getRepository(DDC6470Source::class);
55
-		$qb = $er->createQueryBuilder("n");
56
-		$qb->setCacheable(true)->setLifetime(3 * 60)->setCacheRegion($region = time());
57
-
58
-		$result = $qb->getQuery()->getResult();
59
-
60
-		$newQueryCount = $this->getCurrentQueryCount();
61
-		$this->assertEquals($queryCount + 1, $newQueryCount, "One for query only. One more appears here @see UnitOfWork:2654.");
62
-
63
-		$this->_em->clear();
64
-
65
-		/** @var EntityRepository $er */
66
-		$er = $this->_em->getRepository(DDC6470Source::class);
67
-		$qb = $er->createQueryBuilder("n");
68
-		$qb->setCacheable(true)->setLifetime(3 * 60)->setCacheRegion($region);
69
-		$qb->getQuery()->getResult();
70
-		$this->assertEquals($newQueryCount, $this->getCurrentQueryCount(), "Assert everything get from cache");
71
-	}
19
+    public function setUp()
20
+    {
21
+        $this->enableSecondLevelCache();
22
+        parent::setUp();
23
+
24
+        try {
25
+            $this->setUpEntitySchema([
26
+                DDC6470Source::class,
27
+                DDC6470Target::class,
28
+            ]);
29
+        } catch (SchemaException $e) {
30
+        }
31
+    }
32
+
33
+    /**
34
+     * @throws \Doctrine\Common\Persistence\Mapping\MappingException
35
+     * @throws \Doctrine\ORM\ORMException
36
+     * @throws \Doctrine\ORM\OptimisticLockException
37
+     */
38
+    public function testOneToOne()
39
+    {
40
+        $source = new DDC6470Source();
41
+        $target = new DDC6470Target();
42
+        $source->setTarget($target);
43
+
44
+        $this->_em->persist($source);
45
+        $this->_em->flush();
46
+        $this->_em->clear();
47
+
48
+        $this->assertTrue($this->_em->getCache()->containsEntity(DDC6470Source::class, ['id' => $source->getId()]));
49
+        $this->assertTrue($this->_em->getCache()->containsEntity(DDC6470Target::class, ['id' => $target->getId()]));
50
+
51
+        $queryCount = $this->getCurrentQueryCount();
52
+
53
+        /** @var EntityRepository $er */
54
+        $er = $this->_em->getRepository(DDC6470Source::class);
55
+        $qb = $er->createQueryBuilder("n");
56
+        $qb->setCacheable(true)->setLifetime(3 * 60)->setCacheRegion($region = time());
57
+
58
+        $result = $qb->getQuery()->getResult();
59
+
60
+        $newQueryCount = $this->getCurrentQueryCount();
61
+        $this->assertEquals($queryCount + 1, $newQueryCount, "One for query only. One more appears here @see UnitOfWork:2654.");
62
+
63
+        $this->_em->clear();
64
+
65
+        /** @var EntityRepository $er */
66
+        $er = $this->_em->getRepository(DDC6470Source::class);
67
+        $qb = $er->createQueryBuilder("n");
68
+        $qb->setCacheable(true)->setLifetime(3 * 60)->setCacheRegion($region);
69
+        $qb->getQuery()->getResult();
70
+        $this->assertEquals($newQueryCount, $this->getCurrentQueryCount(), "Assert everything get from cache");
71
+    }
72 72
 }
73 73
 
74 74
 /**
@@ -77,57 +77,57 @@  discard block
 block discarded – undo
77 77
  */
78 78
 class DDC6470Target
79 79
 {
80
-	/**
81
-	 * @Id
82
-	 * @GeneratedValue()
83
-	 * @Column(type="integer")
84
-	 * @var int
85
-	 */
86
-	protected $id;
87
-	/**
88
-	 * @Cache("NONSTRICT_READ_WRITE")
89
-	 * @OneToOne(targetEntity="Doctrine\Tests\ORM\Functional\Ticket\DDC6470Source", inversedBy="target")
90
-	 * @var DDC6470Source
91
-	 */
92
-	protected $source;
93
-
94
-	/**
95
-	 * @return int
96
-	 */
97
-	public function getId(): ?int
98
-	{
99
-		return $this->id;
100
-	}
101
-
102
-	/**
103
-	 * @param int $id
104
-	 * @return DDC6470Target
105
-	 */
106
-	public function setId(?int $id): DDC6470Target
107
-	{
108
-		$this->id = $id;
109
-
110
-		return $this;
111
-	}
112
-
113
-	/**
114
-	 * @return DDC6470Source
115
-	 */
116
-	public function getSource(): ?DDC6470Source
117
-	{
118
-		return $this->source;
119
-	}
120
-
121
-	/**
122
-	 * @param DDC6470Source $source
123
-	 * @return DDC6470Target
124
-	 */
125
-	public function setSource(?DDC6470Source $source): DDC6470Target
126
-	{
127
-		$this->source = $source;
128
-
129
-		return $this;
130
-	}
80
+    /**
81
+     * @Id
82
+     * @GeneratedValue()
83
+     * @Column(type="integer")
84
+     * @var int
85
+     */
86
+    protected $id;
87
+    /**
88
+     * @Cache("NONSTRICT_READ_WRITE")
89
+     * @OneToOne(targetEntity="Doctrine\Tests\ORM\Functional\Ticket\DDC6470Source", inversedBy="target")
90
+     * @var DDC6470Source
91
+     */
92
+    protected $source;
93
+
94
+    /**
95
+     * @return int
96
+     */
97
+    public function getId(): ?int
98
+    {
99
+        return $this->id;
100
+    }
101
+
102
+    /**
103
+     * @param int $id
104
+     * @return DDC6470Target
105
+     */
106
+    public function setId(?int $id): DDC6470Target
107
+    {
108
+        $this->id = $id;
109
+
110
+        return $this;
111
+    }
112
+
113
+    /**
114
+     * @return DDC6470Source
115
+     */
116
+    public function getSource(): ?DDC6470Source
117
+    {
118
+        return $this->source;
119
+    }
120
+
121
+    /**
122
+     * @param DDC6470Source $source
123
+     * @return DDC6470Target
124
+     */
125
+    public function setSource(?DDC6470Source $source): DDC6470Target
126
+    {
127
+        $this->source = $source;
128
+
129
+        return $this;
130
+    }
131 131
 
132 132
 }
133 133
 
@@ -137,56 +137,56 @@  discard block
 block discarded – undo
137 137
  */
138 138
 class DDC6470Source
139 139
 {
140
-	/**
141
-	 * @Id
142
-	 * @GeneratedValue()
143
-	 * @Column(type="integer")
144
-	 * @var int
145
-	 */
146
-	protected $id;
147
-	/**
148
-	 * @Cache("NONSTRICT_READ_WRITE")
149
-	 * @OneToOne(targetEntity="Doctrine\Tests\ORM\Functional\Ticket\DDC6470Target", mappedBy="source", cascade={"persist"})
150
-	 * @var DDC6470Target
151
-	 */
152
-	protected $target;
153
-
154
-	/**
155
-	 * @return int
156
-	 */
157
-	public function getId(): ?int
158
-	{
159
-		return $this->id;
160
-	}
161
-
162
-	/**
163
-	 * @param int $id
164
-	 * @return DDC6470Source
165
-	 */
166
-	public function setId(?int $id): DDC6470Source
167
-	{
168
-		$this->id = $id;
169
-
170
-		return $this;
171
-	}
172
-
173
-	/**
174
-	 * @return DDC6470Target
175
-	 */
176
-	public function getTarget(): ?DDC6470Target
177
-	{
178
-		return $this->target;
179
-	}
180
-
181
-	/**
182
-	 * @param DDC6470Target $target
183
-	 * @return DDC6470Source
184
-	 */
185
-	public function setTarget(?DDC6470Target $target): DDC6470Source
186
-	{
187
-		$this->target = $target;
188
-
189
-		return $this;
190
-	}
140
+    /**
141
+     * @Id
142
+     * @GeneratedValue()
143
+     * @Column(type="integer")
144
+     * @var int
145
+     */
146
+    protected $id;
147
+    /**
148
+     * @Cache("NONSTRICT_READ_WRITE")
149
+     * @OneToOne(targetEntity="Doctrine\Tests\ORM\Functional\Ticket\DDC6470Target", mappedBy="source", cascade={"persist"})
150
+     * @var DDC6470Target
151
+     */
152
+    protected $target;
153
+
154
+    /**
155
+     * @return int
156
+     */
157
+    public function getId(): ?int
158
+    {
159
+        return $this->id;
160
+    }
161
+
162
+    /**
163
+     * @param int $id
164
+     * @return DDC6470Source
165
+     */
166
+    public function setId(?int $id): DDC6470Source
167
+    {
168
+        $this->id = $id;
169
+
170
+        return $this;
171
+    }
172
+
173
+    /**
174
+     * @return DDC6470Target
175
+     */
176
+    public function getTarget(): ?DDC6470Target
177
+    {
178
+        return $this->target;
179
+    }
180
+
181
+    /**
182
+     * @param DDC6470Target $target
183
+     * @return DDC6470Source
184
+     */
185
+    public function setTarget(?DDC6470Target $target): DDC6470Source
186
+    {
187
+        $this->target = $target;
188
+
189
+        return $this;
190
+    }
191 191
 
192 192
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types=1);
3
+declare(strict_types = 1);
4 4
 
5 5
 namespace Doctrine\Tests\ORM\Functional\Ticket;
6 6
 
Please login to merge, or discard this patch.