Skip to content

Commit

Permalink
Merge branch 'develop' into 3.x
Browse files Browse the repository at this point in the history
  • Loading branch information
daftspunk committed Feb 28, 2022
2 parents bd28e33 + 2f355ae commit 7f22bcb
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 8 deletions.
8 changes: 8 additions & 0 deletions src/Database/Models/Revision.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ class Revision extends Model
*/
public function getNewValueAttribute($value)
{
if ($value === null) {
return null;
}

if ($this->cast === 'date') {
return $this->asDateTime($value);
}
Expand All @@ -32,6 +36,10 @@ public function getNewValueAttribute($value)
*/
public function getOldValueAttribute($value)
{
if ($value === null) {
return null;
}

if ($this->cast === 'date') {
return $this->asDateTime($value);
}
Expand Down
7 changes: 0 additions & 7 deletions src/Database/Relations/HasMany.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,6 @@ public function setSimpleValue($value)
$this->parent->setRelation($this->relationName, $collection);

$this->parent->bindEventOnce('model.afterSave', function() use ($collection) {
// Relation is already set, do nothing. This prevents the relationship
// from being nulled below and left unset because the save will ignore
// attribute values that are numerically equivalent (not dirty).
$collection = $collection->reject(function ($instance) {
return $instance->getOriginal($this->getForeignKeyName()) == $this->getParentKey();
});

$existingIds = $collection->pluck($this->localKey)->all();
$this->whereNotIn($this->localKey, $existingIds)
->update([$this->getForeignKeyName() => null]);
Expand Down
2 changes: 1 addition & 1 deletion src/Scaffold/Console/plugin/plugin.stub
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class Plugin extends PluginBase
/**
* Boot method, called right before the request route.
*
* @return array
* @return void
*/
public function boot()
{
Expand Down
17 changes: 17 additions & 0 deletions tests/Assetic/StylesheetMinifyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,23 @@ public function testEmptyClassPreserve()
$this->assertEquals($output, $mockAsset->getContent());
}

public function testEmptyCommentPreserve()
{
$input = ''.
'
body { background: blue; }
/**/
.view { color: red; }';

$output = 'body{background:blue}/**/.view{color:red}';

$mockAsset = new MockAsset($input);
$result = new StylesheetMinify();
$result->filterDump($mockAsset);

$this->assertEquals($output, $mockAsset->getContent());
}

public function testSpecialCommentPreservation()
{
$input = 'body {/*! Keep me */}';
Expand Down

0 comments on commit 7f22bcb

Please sign in to comment.