Skip to content

Instantly share code, notes, and snippets.

View robbieaverill's full-sized avatar

robbieaverill

  • Aotearoa
View GitHub Profile
diff --git a/tests/php/VersionedCascadeDeletesTest.php b/tests/php/VersionedCascadeDeletesTest.php
index 1d7bd5e..c3c3756 100644
--- a/tests/php/VersionedCascadeDeletesTest.php
+++ b/tests/php/VersionedCascadeDeletesTest.php
@@ -101,6 +101,44 @@ class VersionedCascadeDeletesTest extends SapphireTest
);
}
+ /**
+ * Test that unpublishing a versioned item with cascade_deletes on an unversioned object doesn't delete the object
<?php
use DNADesign\Elemental\Extensions\ElementalPageExtension;
use DNADesign\Elemental\Models\ElementalArea;
use Elemental220Test\StubBlock;
use Elemental220Test\StubExtension;
use Elemental220Test\StubPage;
use SilverStripe\Dev\SapphireTest;
class Elemental220Test extends SapphireTest
@robbieaverill
robbieaverill / monkey-bar.patch
Created October 24, 2017 22:38
Reacting to change
diff --git a/client/src/legacy/TinyMCE_sslink-internal.js b/client/src/legacy/TinyMCE_sslink-internal.js
index c20a6c0d..ba5312f5 100644
--- a/client/src/legacy/TinyMCE_sslink-internal.js
+++ b/client/src/legacy/TinyMCE_sslink-internal.js
@@ -61,10 +61,7 @@ jQuery.entwine('ss', ($) => {
const handleHide = () => this.close();
const handleInsert = (...args) => this.handleInsert(...args);
const attrs = this.getOriginalAttributes();
- const selection = tinymce.activeEditor.selection;
- const selectionContent = selection.getContent() || '';
@robbieaverill
robbieaverill / ss4-upgradability-check.php
Created February 21, 2017 05:12
A VERY quick and rough tool to check your project for SilverStripe upgradability
<?php
/**
* Test (roughly) your SilverStripe 4 upgradability. Ensure you run "composer require composer/semver" first.
*
* @author Robbie Averill <robbie@silverstripe.com>
*/
require_once __DIR__ . '/vendor/autoload.php';
use Composer\Semver\Semver;
@robbieaverill
robbieaverill / mysite-env-shiv.php
Created February 7, 2017 00:10
A shiv for dotenv files from existing _ss_environment.php files in SilverStripe 4
<?php
/**
* Imports SS_* constants into the environment so dotenv can read them.
*
* You should include this from your mysite/_config.php file BEFORE ConfigureFromEnv.php
*
* This file is temporary - until SilverStripe Platform supports auto-generation
* of .env files instead of/as well as _ss_environment.php
*/
if (!file_exists(BASE_PATH . '/.env')) {
<?php
/**
* Screw you John Campbell! I couldn't work it out either!
*/
for ($found = false, $a = 20, $b = 60; $found === false; $a++, $b++) {
if ($a + 20 === $b - 20 && ($a - 22) * 2 === $b) {
$found = true;
echo "$a + 20 = " . ($a+20) . " and $b - 20 = " . ($b-20), PHP_EOL;
echo "$a - 22 = " . ($a-22) . " which doubled is the same as $b", PHP_EOL;
break;