Skip to content

Commit b9db500

Browse files
authored
Remove CMS db trait (#45340)
1 parent f02f192 commit b9db500

File tree

4 files changed

+0
-127
lines changed

4 files changed

+0
-127
lines changed

build/psr12/ruleset.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@
9393
<exclude-pattern type="relative">libraries/src/Encrypt/Totp\.php</exclude-pattern>
9494
<exclude-pattern type="relative">libraries/src/Form/Field/CaptchaField\.php</exclude-pattern>
9595
<exclude-pattern type="relative">libraries/src/Input/Json\.php</exclude-pattern>
96-
<exclude-pattern type="relative">libraries/src/MVC/Model/DatabaseAwareTrait\.php</exclude-pattern>
9796
<exclude-pattern type="relative">libraries/src/MVC/Model/FormBehaviorTrait\.php</exclude-pattern>
9897
<exclude-pattern type="relative">libraries/src/MVC/Model/ItemModel\.php</exclude-pattern>
9998
<exclude-pattern type="relative">libraries/src/MVC/Model/StateBehaviorTrait\.php</exclude-pattern>

libraries/src/MVC/Model/DatabaseAwareTrait.php

Lines changed: 0 additions & 79 deletions
This file was deleted.

ruleset.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@
9797
<exclude-pattern type="relative">libraries/src/Form/Field/CaptchaField\.php</exclude-pattern>
9898
<exclude-pattern type="relative">libraries/src/Input/Json\.php</exclude-pattern>
9999
<exclude-pattern type="relative">libraries/src/Installer/Manifest\.php</exclude-pattern>
100-
<exclude-pattern type="relative">libraries/src/MVC/Model/DatabaseAwareTrait\.php</exclude-pattern>
101100
<exclude-pattern type="relative">libraries/src/MVC/Model/FormBehaviorTrait\.php</exclude-pattern>
102101
<exclude-pattern type="relative">libraries/src/MVC/Model/ItemModel\.php</exclude-pattern>
103102
<exclude-pattern type="relative">libraries/src/MVC/Model/StateBehaviorTrait\.php</exclude-pattern>

tests/Unit/Libraries/Cms/MVC/Model/DatabaseModelTest.php

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
use Exception;
1414
use Joomla\CMS\MVC\Factory\MVCFactoryInterface;
1515
use Joomla\CMS\MVC\Model\BaseDatabaseModel;
16-
use Joomla\CMS\MVC\Model\DatabaseAwareTrait;
1716
use Joomla\CMS\Table\Table;
1817
use Joomla\CMS\User\User;
1918
use Joomla\Database\DatabaseInterface;
@@ -303,49 +302,4 @@ public function testCheckedOutWitFieldEmptyUserSet()
303302

304303
$this->assertTrue($model->isCheckedOut((object)['checked_out' => 1]));
305304
}
306-
307-
/**
308-
* @testdox still can use the old trait
309-
*
310-
* @return void
311-
*
312-
* @since 4.2.0
313-
*
314-
* @deprecated 5.0 Must be removed when trait gets deleted
315-
*/
316-
public function testUseOldMVCTrait()
317-
{
318-
$db = $this->createStub(DatabaseInterface::class);
319-
320-
$model = new class (['dbo' => $db], $this->createStub(MVCFactoryInterface::class)) extends BaseDatabaseModel {
321-
use DatabaseAwareTrait;
322-
};
323-
324-
$this->assertEquals($db, $model->getDbo());
325-
}
326-
327-
/**
328-
* @testdox operates normally even when no variable is declared
329-
*
330-
* @return void
331-
*
332-
* @since 4.2.0
333-
*
334-
* @deprecated 5.0 This has to be removed when we do not support the MVC Trait anymore
335-
*/
336-
public function testNotDeclaredVariable()
337-
{
338-
$model = new class (['dbo' => $this->createStub(DatabaseInterface::class)], $this->createStub(MVCFactoryInterface::class)) extends BaseDatabaseModel {
339-
public function cache($key, $value)
340-
{
341-
if (!isset($this->test[$key])) {
342-
$this->test[$key] = $value;
343-
}
344-
345-
return $this->test[$key];
346-
}
347-
};
348-
349-
$this->assertEquals('test', $model->cache(1, 'test'));
350-
}
351305
}

0 commit comments

Comments
 (0)