Browse Source

Remove deprecations.

mscherer 7 years ago
parent
commit
9d1a719c98

+ 3 - 4
phpunit.xml.dist

@@ -5,8 +5,7 @@
 	backupStaticAttributes="false"
 	processIsolation="false"
 	stopOnFailure="false"
-	syntaxCheck="false"
-	bootstrap="./tests/bootstrap.php">
+	bootstrap="tests/bootstrap.php">
 	<php>
 		<ini name="memory_limit" value="-1"/>
 		<ini name="apc.enable_cli" value="1"/>
@@ -20,9 +19,9 @@
 		</testsuite>
 	</testsuites>
 		<listeners>
-		<listener class="\Cake\TestSuite\Fixture\FixtureInjector">
+		<listener class="Cake\TestSuite\Fixture\FixtureInjector">
 			<arguments>
-				<object class="\Cake\TestSuite\Fixture\FixtureManager" />
+				<object class="Cake\TestSuite\Fixture\FixtureManager" />
 			</arguments>
 		</listener>
 	</listeners>

+ 14 - 11
src/Controller/Component/CommonComponent.php

@@ -31,8 +31,8 @@ class CommonComponent extends Component {
 		if ($this->Controller->request->getQuery() && !Configure::read('DataPreparation.notrim')) {
 			$this->Controller->request->query = Utility::trimDeep($this->Controller->request->getQuery());
 		}
-		if (!empty($this->Controller->request->params['pass']) && !Configure::read('DataPreparation.notrim')) {
-			$this->Controller->request->params['pass'] = Utility::trimDeep($this->Controller->request->params['pass']);
+		if ($this->Controller->request->getParam('pass') && !Configure::read('DataPreparation.notrim')) {
+			$this->Controller->request->params['pass'] = Utility::trimDeep($this->Controller->request->getParam('pass'));
 		}
 	}
 
@@ -131,7 +131,8 @@ class CommonComponent extends Component {
 	 * @return mixed
 	 */
 	public function getPassedParam($var, $default = null) {
-		return (isset($this->Controller->request->params['pass'][$var])) ? $this->Controller->request->params['pass'][$var] : $default;
+		$passed = $this->Controller->request->getParam('pass');
+		return (isset($passed[$var])) ? $passed[$var] : $default;
 	}
 
 	/**
@@ -156,14 +157,16 @@ class CommonComponent extends Component {
 	 * @return mixed URL
 	 */
 	public function currentUrl($asString = false) {
-		if (isset($this->Controller->request->params['prefix']) && mb_strpos($this->Controller->request->params['action'], $this->Controller->request->params['prefix']) === 0) {
-			$action = mb_substr($this->Controller->request->params['action'], mb_strlen($this->Controller->request->params['prefix']) + 1);
-		} else {
-			$action = $this->Controller->request->params['action'];
-		}
+		$action = $this->Controller->request->getParam('action');
 
-		$url = array_merge($this->Controller->request->params['pass'], ['prefix' => isset($this->Controller->request->params['prefix']) ? $this->Controller->request->params['prefix'] : null,
-			'plugin' => $this->Controller->request->params['plugin'], 'action' => $action, 'controller' => $this->Controller->request->params['controller']]);
+		$passed = (array)$this->Controller->request->getParam('pass');
+		$url = [
+			'prefix' => $this->Controller->request->getParam('prefix'),
+			'plugin' => $this->Controller->request->getParam('plugin'),
+			'action' => $action,
+			'controller' => $this->Controller->request->getParam('controller'),
+		];
+		$url = array_merge($passed, $url);
 
 		if ($asString === true) {
 			return Router::url($url);
@@ -239,7 +242,7 @@ class CommonComponent extends Component {
 				if (!empty($controller) && $refererController !== '*' && $refererController !== $controller) {
 					continue;
 				}
-				if (empty($controller) && $refererController !== $this->Controller->request->params['controller']) {
+				if (empty($controller) && $refererController !== $this->Controller->request->getParam('controller')) {
 					continue;
 				}
 				if (!in_array($referer['action'], (array)$this->Controller->autoRedirectActions, true)) {

+ 2 - 2
src/Model/Behavior/BitmaskedBehavior.php

@@ -236,7 +236,7 @@ class BitmaskedBehavior extends Behavior {
 			}
 			$key = $comparison->getField();
 
-			if ($key !== $mappedField && $key !== $this->_table->alias() . '.' . $mappedField) {
+			if ($key !== $mappedField && $key !== $this->_table->getAlias() . '.' . $mappedField) {
 				return $comparison;
 			}
 
@@ -300,7 +300,7 @@ class BitmaskedBehavior extends Behavior {
 	 */
 	protected function _getDefault($field) {
 		$default = null;
-		$schema = $this->_table->schema()->column($field);
+		$schema = $this->_table->getSchema()->getColumn($field);
 
 		if ($schema && isset($schema['default'])) {
 			$default = $schema['default'];

+ 0 - 1
src/Model/Behavior/ConfirmableBehavior.php

@@ -74,7 +74,6 @@ class ConfirmableBehavior extends Behavior {
 				'last' => true]
 		);
 		$validator->requirePresence($field);
-		//$validator->allowEmpty($field, false);
 	}
 
 }

+ 3 - 2
src/Model/Behavior/JsonableBehavior.php

@@ -3,6 +3,7 @@
 namespace Tools\Model\Behavior;
 
 use ArrayObject;
+use Cake\Collection\CollectionInterface;
 use Cake\Database\Type;
 use Cake\Datasource\EntityInterface;
 use Cake\Event\Event;
@@ -89,7 +90,7 @@ class JsonableBehavior extends Behavior {
 			throw new RuntimeException('Fields and Map need to be of the same length if map is specified.');
 		}
 		foreach ($this->_config['fields'] as $field) {
-			$this->_table->schema()->columnType($field, 'array');
+			$this->_table->getSchema()->setColumnType($field, 'array');
 		}
 		if ($this->_config['encodeParams']['options'] === null) {
 			$options = JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_AMP | JSON_HEX_QUOT | JSON_ERROR_INF_OR_NAN | JSON_PARTIAL_OUTPUT_ON_ERROR;
@@ -110,7 +111,7 @@ class JsonableBehavior extends Behavior {
 	 * @return void
 	 */
 	public function beforeFind(Event $event, Query $query, ArrayObject $options, $primary) {
-		$query->formatResults(function ($results) {
+		$query->formatResults(function (CollectionInterface $results) {
 			return $results->map(function ($row) {
 				if (!$row instanceOf Entity) {
 					return $row;

+ 6 - 4
src/Model/Behavior/NeighborBehavior.php

@@ -22,15 +22,17 @@ class NeighborBehavior extends Behavior {
 	 * @param array $options
 	 *
 	 * @return array
+	 *
+	 * @throws \InvalidArgumentException
 	 */
 	public function neighbors($id, array $options = []) {
 		if (!$id) {
 			throw new InvalidArgumentException("The 'id' key is required for find('neighbors')");
 		}
 
-		$sortField = $this->_table->hasField('created') ? 'created' : $this->_table->primaryKey();
+		$sortField = $this->_table->hasField('created') ? 'created' : $this->_table->getPrimaryKey();
 		$defaults = [
-			'sortField' => $this->_table->alias() . '.' . $sortField,
+			'sortField' => $this->_table->getAlias() . '.' . $sortField,
 		];
 		$options += $defaults;
 
@@ -39,7 +41,7 @@ class NeighborBehavior extends Behavior {
 		$sortDirSymb = $normalDirection ? ['>=', '<='] : ['<=', '>='];
 
 		if (empty($options['value'])) {
-			$data = $this->_table->find('all', ['conditions' => [$this->_table->primaryKey() => $id]])->first();
+			$data = $this->_table->find('all', ['conditions' => [$this->_table->getPrimaryKey() => $id]])->first();
 			list($model, $sortField) = pluginSplit($options['sortField']);
 			$options['value'] = $data[$sortField];
 		}
@@ -54,7 +56,7 @@ class NeighborBehavior extends Behavior {
 		if (!empty($options['fields'])) {
 			$findOptions['fields'] = $options['fields'];
 		}
-		$findOptions['conditions'][$this->_table->alias() . '.' . $this->_table->primaryKey() . ' !='] = $id;
+		$findOptions['conditions'][$this->_table->getAlias() . '.' . $this->_table->getPrimaryKey() . ' !='] = $id;
 
 		$prevOptions = $findOptions;
 		$prevOptions['conditions'] = Hash::merge($prevOptions['conditions'], [$options['sortField'] . ' ' . $sortDirSymb[1] => $options['value']]);

+ 7 - 7
src/Model/Behavior/PasswordableBehavior.php

@@ -376,8 +376,8 @@ class PasswordableBehavior extends Behavior {
 	 */
 	public function validateCurrentPwd($pwd, $context) {
 		$uid = null;
-		if (!empty($context['data'][$this->_table->primaryKey()])) {
-			$uid = $context['data'][$this->_table->primaryKey()];
+		if (!empty($context['data'][$this->_table->getPrimaryKey()])) {
+			$uid = $context['data'][$this->_table->getPrimaryKey()];
 		} else {
 			trigger_error('No user id given');
 			return false;
@@ -429,14 +429,14 @@ class PasswordableBehavior extends Behavior {
 	 */
 	public function validateNotSameHash($data, $context) {
 		$field = $this->_config['field'];
-		if (empty($context['data'][$this->_table->primaryKey()])) {
+		if (empty($context['data'][$this->_table->getPrimaryKey()])) {
 			return true;
 		}
 
-		$primaryKey = $context['data'][$this->_table->primaryKey()];
+		$primaryKey = $context['data'][$this->_table->getPrimaryKey()];
 		$value = $context['data'][$context['field']];
 
-		$dbValue = $this->_table->find()->where([$this->_table->alias() . '.' . $this->_table->primaryKey() => $primaryKey])->first();
+		$dbValue = $this->_table->find()->where([$this->_table->getAlias() . '.' . $this->_table->getPrimaryKey() => $primaryKey])->first();
 		if (!$dbValue) {
 			return true;
 		}
@@ -457,8 +457,8 @@ class PasswordableBehavior extends Behavior {
 	protected function _validateSameHash($pwd, $context) {
 		$field = $this->_config['field'];
 
-		$primaryKey = $context['data'][$this->_table->primaryKey()];
-		$dbValue = $this->_table->find()->where([$this->_table->alias() . '.' . $this->_table->primaryKey() => $primaryKey])->first();
+		$primaryKey = $context['data'][$this->_table->getPrimaryKey()];
+		$dbValue = $this->_table->find()->where([$this->_table->getAlias() . '.' . $this->_table->getPrimaryKey() => $primaryKey])->first();
 		if (!$dbValue) {
 			return false;
 		}

+ 7 - 6
src/Model/Behavior/ResetBehavior.php

@@ -81,13 +81,14 @@ class ResetBehavior extends Behavior {
 	 *
 	 * @param array $params
 	 * @return int Modified records
+	 * @throws \RuntimeException
 	 */
 	public function resetRecords(array $params = []) {
 		$defaults = [
 			'page' => 1,
 			'limit' => $this->_config['limit'],
 			'fields' => [],
-			'order' => [$this->_table->alias() . '.' . $this->_table->primaryKey() => 'ASC'],
+			'order' => [$this->_table->getAlias() . '.' . $this->_table->getPrimaryKey() => 'ASC'],
 			'conditions' => $this->_config['scope'],
 		];
 		if (!empty($this->_config['fields'])) {
@@ -96,11 +97,11 @@ class ResetBehavior extends Behavior {
 					throw new RuntimeException('Table does not have field ' . $field);
 				}
 			}
-			$defaults['fields'] = array_merge([$this->_table->alias() . '.' . $this->_table->primaryKey()], $this->_config['fields']);
+			$defaults['fields'] = array_merge([$this->_table->getAlias() . '.' . $this->_table->getPrimaryKey()], $this->_config['fields']);
 		} else {
-			$defaults['fields'] = [$this->_table->alias() . '.' . $this->_table->primaryKey()];
-			if ($this->_table->displayField() !== $this->_table->primaryKey()) {
-				$defaults['fields'][] = $this->_table->alias() . '.' . $this->_table->displayField();
+			$defaults['fields'] = [$this->_table->getAlias() . '.' . $this->_table->getPrimaryKey()];
+			if ($this->_table->getDisplayField() !== $this->_table->getPrimaryKey()) {
+				$defaults['fields'][] = $this->_table->getAlias() . '.' . $this->_table->getDisplayField();
 			}
 		}
 
@@ -151,7 +152,7 @@ class ResetBehavior extends Behavior {
 
 				$res = $this->_table->save($record, compact('validate', 'fieldList'));
 				if (!$res) {
-					throw new RuntimeException(print_r($record->errors(), true));
+					throw new RuntimeException(print_r($record->getErrors(), true));
 				}
 				$modified++;
 			}

+ 10 - 10
src/Model/Behavior/SluggedBehavior.php

@@ -97,7 +97,7 @@ class SluggedBehavior extends Behavior {
 	 */
 	public function __construct(Table $table, array $config = []) {
 		$this->_defaultConfig['notices'] = Configure::read('debug');
-		$this->_defaultConfig['label'] = $table->displayField();
+		$this->_defaultConfig['label'] = $table->getDisplayField();
 		foreach ($this->_defaultConfig['replace'] as $key => $value) {
 			$this->_defaultConfig['replace'][$key] = __d('tools', $value);
 		}
@@ -117,7 +117,7 @@ class SluggedBehavior extends Behavior {
 	 */
 	public function initialize(array $config) {
 		if ($this->_config['length'] === null) {
-			$length = $this->_table->schema()->column($this->_config['field'])['length'];
+			$length = $this->_table->getSchema()->getColumn($this->_config['field'])['length'];
 			$this->_config['length'] = $length ?: 0;
 		}
 
@@ -128,15 +128,15 @@ class SluggedBehavior extends Behavior {
 		}
 		if ($this->_config['length']) {
 			foreach ($label as $field) {
-				$alias = $this->_table->alias();
+				$alias = $this->_table->getAlias();
 				if (strpos($field, '.')) {
 					list($alias, $field) = explode('.', $field);
 					if (!$this->_table->$alias->hasField($field)) {
-						throw new RuntimeException('(SluggedBehavior::setup) model ' . $this->_table->$alias->alias() . ' is missing the field ' . $field .
-							' (specified in the setup for model ' . $this->_table->alias() . ') ');
+						throw new RuntimeException('(SluggedBehavior::setup) model ' . $this->_table->$alias->getAlias() . ' is missing the field ' . $field .
+							' (specified in the setup for model ' . $this->_table->getAlias() . ') ');
 					}
 				} elseif (!$this->_table->hasField($field) && !method_exists($this->_table->entityClass(), '_get' . Inflector::classify($field))) {
-					throw new RuntimeException('(SluggedBehavior::setup) model ' . $this->_table->alias() . ' is missing the field ' . $field . ' specified in the setup.');
+					throw new RuntimeException('(SluggedBehavior::setup) model ' . $this->_table->getAlias() . ' is missing the field ' . $field . ' specified in the setup.');
 				}
 			}
 		}
@@ -227,7 +227,7 @@ class SluggedBehavior extends Behavior {
 	 */
 	public function needsSlugUpdate(EntityInterface $entity, $deep = false) {
 		foreach ((array)$this->_config['label'] as $label) {
-			if ($entity->dirty($label)) {
+			if ($entity->isDirty($label)) {
 				return true;
 			}
 		}
@@ -308,12 +308,12 @@ class SluggedBehavior extends Behavior {
 			if (!$entity) {
 				throw new RuntimeException('Needs an Entity to work on');
 			}
-			$field = $this->_table->alias() . '.' . $this->_config['field'];
+			$field = $this->_table->getAlias() . '.' . $this->_config['field'];
 			$conditions = [$field => $slug];
 			$conditions = array_merge($conditions, $this->_config['scope']);
-			$id = $entity->get($this->_table->primaryKey());
+			$id = $entity->get($this->_table->getPrimaryKey());
 			if ($id) {
-				$conditions['NOT'][$this->_table->alias() . '.' . $this->_table->primaryKey()] = $id;
+				$conditions['NOT'][$this->_table->getAlias() . '.' . $this->_table->getPrimaryKey()] = $id;
 			}
 			$i = 0;
 			$suffix = '';

+ 6 - 3
src/Model/Behavior/ToggleBehavior.php

@@ -6,7 +6,7 @@ use ArrayObject;
 use Cake\Datasource\EntityInterface;
 use Cake\Event\Event;
 use Cake\ORM\Behavior;
-use Symfony\Component\Console\Exception\LogicException;
+use LogicException;
 
 /**
  * ToggleBehavior
@@ -53,7 +53,7 @@ class ToggleBehavior extends Behavior {
 		$order = $this->getConfig('findOrder');
 		if ($order === null) {
 			$order = [];
-			if ($this->_table->schema()->column('modified')) {
+			if ($this->_table->getSchema()->getColumn('modified')) {
 				$order['modified'] = 'DESC';
 			}
 		}
@@ -72,6 +72,7 @@ class ToggleBehavior extends Behavior {
 	 * @param \Cake\Datasource\EntityInterface $entity
 	 * @param \ArrayObject $options
 	 * @return void
+	 * @throws \LogicException
 	 */
 	public function beforeSave(Event $event, EntityInterface $entity, ArrayObject $options) {
 		$field = $this->getConfig('field');
@@ -101,13 +102,15 @@ class ToggleBehavior extends Behavior {
 	 * @param \ArrayObject $options
 	 *
 	 * @return void
+	 *
+	 * @throws \LogicException
 	 */
 	public function afterSave(Event $event, EntityInterface $entity, ArrayObject $options) {
 		if ($this->_config['on'] !== 'afterSave') {
 			return;
 		}
 
-		if (!$entity->dirty($this->getConfig('field'))) {
+		if (!$entity->isDirty($this->getConfig('field'))) {
 			return;
 		}
 

+ 9 - 9
src/Model/Table/Table.php

@@ -26,7 +26,7 @@ class Table extends ShimTable {
 	 */
 	public function validateAll(array $entities) {
 		foreach ($entities as $entity) {
-			if ($entity->errors()) {
+			if ($entity->getErrors()) {
 				return false;
 			}
 		}
@@ -81,7 +81,7 @@ class Table extends ShimTable {
 	 * @return int|bool next auto increment value or False on failure
 	 */
 	public function getNextAutoIncrement() {
-		$query = "SHOW TABLE STATUS WHERE name = '" . $this->table() . "'";
+		$query = "SHOW TABLE STATUS WHERE name = '" . $this->getTable() . "'";
 		$statement = $this->_connection->execute($query);
 		$result = $statement->fetch();
 		if (!isset($result[10])) {
@@ -96,7 +96,7 @@ class Table extends ShimTable {
 	 * @return void
 	 */
 	public function truncate() {
-		$sql = $this->schema()->truncateSql($this->_connection);
+		$sql = $this->getSchema()->truncateSql($this->_connection);
 		foreach ($sql as $snippet) {
 			$this->_connection->execute($snippet);
 		}
@@ -120,12 +120,12 @@ class Table extends ShimTable {
 		$defaults = [
 			'contain' => [$tableName],
 			'group' => $groupField,
-			'order' => isset($this->$tableName->order) ? $this->$tableName->order : [$tableName . '.' . $this->$tableName->displayField() => 'ASC'],
+			'order' => isset($this->$tableName->order) ? $this->$tableName->order : [$tableName . '.' . $this->$tableName->getDisplayField() => 'ASC'],
 		];
 		if ($type === 'list') {
-			$defaults['fields'] = [$tableName . '.' . $this->$tableName->primaryKey(), $tableName . '.' . $this->$tableName->displayField()];
-			$defaults['keyField'] = $tableName . '.' . $this->$tableName->primaryKey();
-			$defaults['valueField'] = $tableName . '.' . $this->$tableName->displayField();
+			$defaults['fields'] = [$tableName . '.' . $this->$tableName->getPrimaryKey(), $tableName . '.' . $this->$tableName->getDisplayField()];
+			$defaults['keyField'] = $tableName . '.' . $this->$tableName->getPrimaryKey();
+			$defaults['valueField'] = $tableName . '.' . $this->$tableName->getDisplayField();
 		}
 		$options += $defaults;
 
@@ -143,10 +143,10 @@ class Table extends ShimTable {
 	public function getFieldInUse($groupField, $type = 'all', array $options = []) {
 		$defaults = [
 			'group' => $groupField,
-			'order' => [$this->displayField() => 'ASC'],
+			'order' => [$this->getDisplayField() => 'ASC'],
 		];
 		if ($type === 'list') {
-			$defaults['fields'] = ['' . $this->primaryKey(), '' . $this->displayField()];
+			$defaults['fields'] = ['' . $this->getPrimaryKey(), '' . $this->getDisplayField()];
 		}
 		$options += $defaults;
 		return $this->find($type, $options);

+ 7 - 7
src/Model/Table/TokensTable.php

@@ -132,9 +132,9 @@ class TokensTable extends Table {
 		if (!$type || !$key) {
 			return false;
 		}
-		$options = ['conditions' => [$this->alias() . '.key' => $key, $this->alias() . '.type' => $type]];
+		$options = ['conditions' => [$this->getAlias() . '.key' => $key, $this->getAlias() . '.type' => $type]];
 		if ($uid) {
-			$options['conditions'][$this->alias() . '.user_id'] = $uid;
+			$options['conditions'][$this->getAlias() . '.user_id'] = $uid;
 		}
 		$res = $this->find('all', $options)->first();
 		if (!$res) {
@@ -193,7 +193,7 @@ class TokensTable extends Table {
 	 */
 	public function garbageCollector() {
 		$conditions = [
-			$this->alias() . '.created <' => date(FORMAT_DB_DATETIME, time() - $this->validity),
+			$this->getAlias() . '.created <' => date(FORMAT_DB_DATETIME, time() - $this->validity),
 		];
 		return $this->deleteAll($conditions);
 	}
@@ -205,11 +205,11 @@ class TokensTable extends Table {
 	 */
 	public function stats() {
 		$keys = [];
-		$keys['unused_valid'] = $this->find('count', ['conditions' => [$this->alias() . '.used' => 0, $this->alias() . '.created >=' => date(FORMAT_DB_DATETIME, time() - $this->validity)]]);
-		$keys['used_valid'] = $this->find('count', ['conditions' => [$this->alias() . '.used' => 1, $this->alias() . '.created >=' => date(FORMAT_DB_DATETIME, time() - $this->validity)]]);
+		$keys['unused_valid'] = $this->find('count', ['conditions' => [$this->getAlias() . '.used' => 0, $this->getAlias() . '.created >=' => date(FORMAT_DB_DATETIME, time() - $this->validity)]]);
+		$keys['used_valid'] = $this->find('count', ['conditions' => [$this->getAlias() . '.used' => 1, $this->getAlias() . '.created >=' => date(FORMAT_DB_DATETIME, time() - $this->validity)]]);
 
-		$keys['unused_invalid'] = $this->find('count', ['conditions' => [$this->alias() . '.used' => 0, $this->alias() . '.created <' => date(FORMAT_DB_DATETIME, time() - $this->validity)]]);
-		$keys['used_invalid'] = $this->find('count', ['conditions' => [$this->alias() . '.used' => 1, $this->alias() . '.created <' => date(FORMAT_DB_DATETIME, time() - $this->validity)]]);
+		$keys['unused_invalid'] = $this->find('count', ['conditions' => [$this->getAlias() . '.used' => 0, $this->getAlias() . '.created <' => date(FORMAT_DB_DATETIME, time() - $this->validity)]]);
+		$keys['used_invalid'] = $this->find('count', ['conditions' => [$this->getAlias() . '.used' => 1, $this->getAlias() . '.created <' => date(FORMAT_DB_DATETIME, time() - $this->validity)]]);
 
 		$types = $this->find('all', ['conditions' => [], 'fields' => ['DISTINCT type']])->toArray();
 		$keys['types'] = !empty($types) ? Hash::extract($types, '{n}.type') : [];

+ 13 - 8
tests/TestCase/Auth/MultiColumnAuthenticateTest.php

@@ -1,8 +1,8 @@
 <?php
 namespace Tools\Test\TestCase\Auth;
 
+use Cake\Http\ServerRequest;
 use Cake\I18n\Time;
-use Cake\Network\Request;
 use Cake\ORM\TableRegistry;
 use Cake\TestSuite\TestCase;
 use Tools\Auth\MultiColumnAuthenticate;
@@ -25,13 +25,18 @@ class MultiColumnAuthenticateTest extends TestCase {
 	protected $response;
 
 	/**
+	 * @var \Cake\Controller\ComponentRegistry
+	 */
+	protected $registry;
+
+	/**
 	 * @return void
 	 */
 	public function setUp() {
 		parent::setUp();
 
-		$this->Registry = $this->getMockBuilder('Cake\Controller\ComponentRegistry')->getMock();
-		$this->auth = new MultiColumnAuthenticate($this->Registry, [
+		$this->registry = $this->getMockBuilder('Cake\Controller\ComponentRegistry')->getMock();
+		$this->auth = new MultiColumnAuthenticate($this->registry, [
 			'fields' => ['username' => 'user_name', 'password' => 'password'],
 			'userModel' => 'MultiColumnUsers',
 			'columns' => ['user_name', 'email']
@@ -48,7 +53,7 @@ class MultiColumnAuthenticateTest extends TestCase {
 	 * @return void
 	 */
 	public function testAuthenticateEmailOrUsername() {
-		$request = new Request('posts/index');
+		$request = new ServerRequest('posts/index');
 		$expected = [
 			'id' => 1,
 			'user_name' => 'mariano',
@@ -76,7 +81,7 @@ class MultiColumnAuthenticateTest extends TestCase {
 	 * @return void
 	 */
 	public function testAuthenticateNoUsername() {
-		$request = new Request('posts/index');
+		$request = new ServerRequest('posts/index');
 		$request->data = ['password' => 'foobar'];
 		$this->assertFalse($this->auth->authenticate($request, $this->response));
 	}
@@ -85,7 +90,7 @@ class MultiColumnAuthenticateTest extends TestCase {
 	 * @return void
 	 */
 	public function testAuthenticateNoPassword() {
-		$request = new Request('posts/index');
+		$request = new ServerRequest('posts/index');
 		$request->data = ['user_name' => 'mariano'];
 		$this->assertFalse($this->auth->authenticate($request, $this->response));
 
@@ -97,7 +102,7 @@ class MultiColumnAuthenticateTest extends TestCase {
 	 * @return void
 	 */
 	public function testAuthenticateInjection() {
-		$request = new Request('posts/index');
+		$request = new ServerRequest('posts/index');
 		$request->data = [
 			'user_name' => '> 1',
 			'password' => "' OR 1 = 1"
@@ -112,7 +117,7 @@ class MultiColumnAuthenticateTest extends TestCase {
 	 */
 	public function testAuthenticateScopeFail() {
 		$this->auth->setConfig('scope', ['user_name' => 'nate']);
-		$request = new Request('posts/index');
+		$request = new ServerRequest('posts/index');
 		$request->data = [
 			'user_name' => 'mariano',
 			'password' => 'password'

+ 15 - 15
tests/TestCase/Controller/Component/CommonComponentTest.php

@@ -3,10 +3,8 @@
 namespace Tools\Test\TestCase\Controller\Component;
 
 use App\Controller\CommonComponentTestController;
-use Cake\Controller\Controller;
 use Cake\Core\Configure;
-use Cake\Network\Request;
-use Cake\Network\Session;
+use Cake\Http\ServerRequest;
 use Tools\TestSuite\TestCase;
 
 /**
@@ -19,7 +17,7 @@ class CommonComponentTest extends TestCase {
 	public $Controller;
 
 	/**
-	 * @var \Cake\Network\Request
+	 * @var \Cake\Http\ServerRequest
 	 */
 	public $request;
 
@@ -31,7 +29,7 @@ class CommonComponentTest extends TestCase {
 
 		Configure::write('App.fullBaseUrl', 'http://localhost');
 
-		$this->request = new Request('/my_controller/foo');
+		$this->request = new ServerRequest('/my_controller/foo');
 		$this->request->params['controller'] = 'MyController';
 		$this->request->params['action'] = 'foo';
 		$this->Controller = new CommonComponentTestController($this->request);
@@ -81,7 +79,7 @@ class CommonComponentTest extends TestCase {
 		$this->assertTrue($this->Controller->Test->isInit);
 		$this->assertTrue($this->Controller->Test->isStartup);
 
-		$config = $this->Controller->Test->config();
+		$config = $this->Controller->Test->getConfig();
 		$this->assertEquals(['x' => 'y'], $config);
 	}
 
@@ -158,11 +156,12 @@ class CommonComponentTest extends TestCase {
 	 * @return void
 	 */
 	public function testAutoRedirectReferer() {
-		$this->request->env('HTTP_REFERER', 'http://localhost/my_controller/some-referer-action');
+		$url = 'http://localhost/my_controller/some-referer-action';
+		$this->Controller->setRequest($this->request->withEnv('HTTP_REFERER', $url));
 
-		$is = $this->Controller->Common->autoRedirect(['action' => 'foo'], true);
-		$is = $this->Controller->response->header();
-		$this->assertSame('http://localhost/my_controller/some-referer-action', $is['Location']);
+		$this->Controller->Common->autoRedirect(['action' => 'foo'], true);
+		$headers = $this->Controller->response->getHeaders();
+		$this->assertSame([$url], $headers['Location']);
 		$this->assertSame(302, $this->Controller->response->getStatusCode());
 	}
 
@@ -170,7 +169,7 @@ class CommonComponentTest extends TestCase {
 	 * @return void
 	 */
 	public function testAutoPostRedirect() {
-		$is = $this->Controller->Common->autoPostRedirect(['action' => 'foo'], true);
+		$this->Controller->Common->autoPostRedirect(['action' => 'foo'], true);
 		$is = $this->Controller->response->header();
 		$this->assertSame('http://localhost/foo', $is['Location']);
 		$this->assertSame(302, $this->Controller->response->getStatusCode());
@@ -180,11 +179,12 @@ class CommonComponentTest extends TestCase {
 	 * @return void
 	 */
 	public function testAutoPostRedirectReferer() {
-		$this->request->env('HTTP_REFERER', 'http://localhost/my_controller/allowed');
+		$url = 'http://localhost/my_controller/allowed';
+		$this->Controller->setRequest($this->request->withEnv('HTTP_REFERER', $url));
 
-		$is = $this->Controller->Common->autoPostRedirect(['controller' => 'MyController', 'action' => 'foo'], true);
-		$is = $this->Controller->response->header();
-		$this->assertSame('http://localhost/my_controller/allowed', $is['Location']);
+		$this->Controller->Common->autoPostRedirect(['controller' => 'MyController', 'action' => 'foo'], true);
+		$headers = $this->Controller->response->getHeaders();
+		$this->assertSame([$url], $headers['Location']);
 		$this->assertSame(302, $this->Controller->response->getStatusCode());
 	}
 

+ 7 - 7
tests/TestCase/Controller/Component/MobileComponentTest.php

@@ -5,7 +5,7 @@ namespace Tools\Test\TestCase\Controller\Component;
 use App\Controller\MobileComponentTestController;
 use Cake\Core\Configure;
 use Cake\Event\Event;
-use Cake\Network\Request;
+use Cake\Http\ServerRequest;
 use Detection\MobileDetect;
 use Tools\TestSuite\TestCase;
 
@@ -37,19 +37,19 @@ class MobileComponentTest extends TestCase {
 	public function setUp() {
 		parent::setUp();
 
-		Request::addDetector('mobile', function ($request) {
+		ServerRequest::addDetector('mobile', function ($request) {
 			$detector = new MobileDetect();
 			return $detector->isMobile();
 		});
-		Request::addDetector('tablet', function ($request) {
+		ServerRequest::addDetector('tablet', function ($request) {
 			$detector = new MobileDetect();
 			return $detector->isTablet();
 		});
 
 		$this->event = new Event('Controller.beforeFilter');
-		$this->Controller = new MobileComponentTestController(new Request());
+		$this->Controller = new MobileComponentTestController(new ServerRequest());
 
-		$this->Controller->request->session()->delete('User');
+		$this->Controller->request->getSession()->delete('User');
 		Configure::delete('User');
 	}
 
@@ -141,7 +141,7 @@ class MobileComponentTest extends TestCase {
 		$_SERVER['HTTP_USER_AGENT'] = 'Some Android device';
 
 		$this->Controller->Mobile->beforeFilter($this->event);
-		$session = $this->Controller->request->session()->read('User');
+		$session = $this->Controller->request->getSession()->read('User');
 		$this->assertSame(['mobile' => 0], $session);
 
 		$this->assertTrue($this->Controller->Mobile->isMobile);
@@ -176,7 +176,7 @@ class MobileComponentTest extends TestCase {
 		$_SERVER['HTTP_USER_AGENT'] = 'Some Android device';
 
 		$this->Controller->Mobile->beforeFilter($this->event);
-		$session = $this->Controller->request->session()->read('User');
+		$session = $this->Controller->request->getSession()->read('User');
 		$this->assertTrue($this->Controller->Mobile->isMobile);
 	}
 

+ 6 - 5
tests/TestCase/Controller/Component/UrlComponentTest.php

@@ -6,7 +6,8 @@ use App\Controller\UrlComponentTestController;
 use Cake\Core\Configure;
 use Cake\Core\Plugin;
 use Cake\Event\Event;
-use Cake\Network\Request;
+use Cake\Http\ServerRequest;
+use Cake\Routing\RouteBuilder;
 use Cake\Routing\Router;
 use Tools\TestSuite\TestCase;
 
@@ -31,7 +32,7 @@ class UrlComponentTest extends TestCase {
 		parent::setUp();
 
 		$this->event = new Event('Controller.beforeFilter');
-		$this->Controller = new UrlComponentTestController(new Request());
+		$this->Controller = new UrlComponentTestController(new ServerRequest());
 
 		Configure::write('App.fullBaseUrl', 'http://localhost');
 	}
@@ -114,11 +115,11 @@ class UrlComponentTest extends TestCase {
 		$this->Controller->Url->request->params['plugin'] = 'Foo';
 		Router::reload();
 		Router::connect('/:controller/:action/*');
-		Router::plugin('Foo', function ($routes) {
+		Router::plugin('Foo', function (RouteBuilder $routes) {
 			$routes->fallbacks();
 		});
-		Router::prefix('admin', function ($routes) {
-			$routes->plugin('Foo', function ($routes) {
+		Router::prefix('admin', function (RouteBuilder $routes) {
+			$routes->plugin('Foo', function (RouteBuilder $routes) {
 				$routes->fallbacks();
 			});
 		});

+ 2 - 2
tests/TestCase/Model/Behavior/BitmaskedBehaviorTest.php

@@ -117,7 +117,7 @@ class BitmaskedBehaviorTest extends TestCase {
 
 		// save + find
 		$entity = $this->Comments->newEntity($data);
-		$this->assertEmpty($entity->errors());
+		$this->assertEmpty($entity->getErrors());
 
 		$res = $this->Comments->save($entity);
 		$this->assertTrue((bool)$res);
@@ -196,7 +196,7 @@ class BitmaskedBehaviorTest extends TestCase {
 			'statuses' => [BitmaskedComment::STATUS_PUBLISHED, BitmaskedComment::STATUS_APPROVED],
 		];
 		$entity = $this->Comments->newEntity($data);
-		$this->assertEmpty($entity->errors());
+		$this->assertEmpty($entity->getErrors());
 
 		$res = $this->Comments->save($entity);
 		$this->assertTrue((bool)$res);

+ 7 - 11
tests/TestCase/Model/Behavior/ConfirmableBehaviorTest.php

@@ -40,20 +40,18 @@ class ConfirmableBehaviorTest extends TestCase {
 			'confirm' => '0'
 		];
 		$animal = $this->Articles->patchEntity($animal, $data);
-		$this->assertNotEmpty($animal->errors());
-		$this->assertSame(['confirm' => ['notBlank' => __d('tools', 'Please confirm the checkbox')]], $animal->errors());
+		$this->assertNotEmpty($animal->getErrors());
+		$this->assertSame(['confirm' => ['notBlank' => __d('tools', 'Please confirm the checkbox')]], $animal->getErrors());
 
 		$data = [
 			'name' => 'FooBar',
 			'confirm' => '1'
 		];
 		$animal = $this->Articles->patchEntity($animal, $data);
-		$this->assertEmpty($animal->errors());
+		$this->assertEmpty($animal->getErrors());
 	}
 
 	/**
-	 * ConfirmableBehaviorTest::testBasicValidation()
-	 *
 	 * @return void
 	 */
 	public function testValidationThatHasBeenModifiedBefore() {
@@ -80,21 +78,19 @@ class ConfirmableBehaviorTest extends TestCase {
 			'confirm' => '0'
 		];
 		$animal = $this->Articles->patchEntity($animal, $data);
-		$this->assertNotEmpty($animal->errors());
+		$this->assertNotEmpty($animal->getErrors());
 
-		$this->assertSame(['confirm' => ['notBlank' => __d('tools', 'Please confirm the checkbox')]], $animal->errors());
+		$this->assertSame(['confirm' => ['notBlank' => __d('tools', 'Please confirm the checkbox')]], $animal->getErrors());
 
 		$data = [
 			'name' => 'FooBar',
 			'confirm' => '1'
 		];
 		$animal = $this->Articles->patchEntity($animal, $data);
-		$this->assertEmpty($animal->errors());
+		$this->assertEmpty($animal->getErrors());
 	}
 
 	/**
-	 * ConfirmableBehaviorTest::testValidationFieldMissing()
-	 *
 	 * @return void
 	 */
 	public function testValidationFieldMissing() {
@@ -106,7 +102,7 @@ class ConfirmableBehaviorTest extends TestCase {
 			'name' => 'FooBar'
 		];
 		$animal = $this->Articles->patchEntity($animal, $data);
-		$this->assertSame(['confirm' => ['_required' => 'This field is required']], $animal->errors());
+		$this->assertSame(['confirm' => ['_required' => 'This field is required']], $animal->getErrors());
 	}
 
 }

+ 21 - 21
tests/TestCase/Model/Behavior/PasswordableBehaviorTest.php

@@ -65,7 +65,7 @@ class PasswordableBehaviorTest extends TestCase {
 		$this->Users->patchEntity($user, $data);
 		$is = $this->Users->save($user);
 		$this->assertFalse($is);
-		$this->assertEquals(['pwd_repeat'], array_keys((array)$user->errors()));
+		$this->assertEquals(['pwd_repeat'], array_keys((array)$user->getErrors()));
 
 		$user = $this->Users->newEntity();
 		$data = [
@@ -75,7 +75,7 @@ class PasswordableBehaviorTest extends TestCase {
 		$this->Users->patchEntity($user, $data);
 		$is = $this->Users->save($user);
 		$this->assertFalse($is);
-		$this->assertEquals(['validateIdentical' => __d('tools', 'valErrPwdNotMatch')], $user->errors()['pwd_repeat']);
+		$this->assertEquals(['validateIdentical' => __d('tools', 'valErrPwdNotMatch')], $user->getErrors()['pwd_repeat']);
 
 		$user = $this->Users->newEntity();
 		$data = [
@@ -119,7 +119,7 @@ class PasswordableBehaviorTest extends TestCase {
 		$this->Users->patchEntity($user, $data);
 		$is = $this->Users->save($user);
 		$this->assertFalse($is);
-		$this->assertEquals(['pwd', 'pwd_repeat'], array_keys((array)$user->errors()));
+		$this->assertEquals(['pwd', 'pwd_repeat'], array_keys((array)$user->getErrors()));
 	}
 
 	/**
@@ -180,7 +180,7 @@ class PasswordableBehaviorTest extends TestCase {
 		$this->Users->patchEntity($user, $data);
 		$is = $this->Users->save($user);
 		$this->assertFalse($is);
-		$this->assertEquals(['pwd', 'pwd_repeat', 'pwd_current'], array_keys((array)$user->errors()));
+		$this->assertEquals(['pwd', 'pwd_repeat', 'pwd_current'], array_keys((array)$user->getErrors()));
 
 		$this->tearDown();
 		$this->setUp();
@@ -337,7 +337,7 @@ class PasswordableBehaviorTest extends TestCase {
 		$this->Users->patchEntity($user, $data);
 		$is = $this->Users->save($user);
 		$this->assertTrue((bool)$is);
-		//debug($user->errors());
+		//debug($user->getErrors());
 
 		$user = clone($userCopy);
 		$data = [
@@ -403,12 +403,12 @@ class PasswordableBehaviorTest extends TestCase {
 			'pwd' => '123456',
 			'pwd_repeat' => '123456'
 		];
-		$user->accessible('*', false); // Mark all properties as protected
-		$user->accessible(['id'], true); // Allow id to be accessible by default
+		$user->setAccess('*', false); // Mark all properties as protected
+		$user->setAccess(['id'], true); // Allow id to be accessible by default
 		$user = $this->Users->patchEntity($user, $data, ['fields' => ['id']]);
 
 		$this->assertNotSame($is['password'], $user['password']);
-		$this->assertTrue($user->dirty('pwd'));
+		$this->assertTrue($user->isDirty('pwd'));
 
 		$options = ['validate' => true];
 		$is = $this->Users->save($user, $options);
@@ -429,8 +429,8 @@ class PasswordableBehaviorTest extends TestCase {
 			'pwd' => 'some', // Too short
 			'pwd_repeat' => 'somex' // Don't match
 		];
-		$user->accessible('*', false); // Mark all properties as protected
-		$user->accessible(['id', 'name'], true);
+		$user->setAccess('*', false); // Mark all properties as protected
+		$user->setAccess(['id', 'name'], true);
 		$this->Users->patchEntity($user, $data, ['fields' => ['id', 'name']]);
 		// Test whitelist setting - only "password" gets auto-added, pwd, pwd_repeat etc need to be added manually
 		// NOTE that I had to remove the code for adding those fields from the behavior (as it was not functional)
@@ -440,7 +440,7 @@ class PasswordableBehaviorTest extends TestCase {
 
 		// Validation errors triggered - as expected
 		$this->assertFalse($is);
-		$this->assertSame(['pwd', 'pwd_repeat', 'pwd_current'], array_keys((array)$user->errors()));
+		$this->assertSame(['pwd', 'pwd_repeat', 'pwd_current'], array_keys((array)$user->getErrors()));
 	}
 
 	/**
@@ -491,12 +491,12 @@ class PasswordableBehaviorTest extends TestCase {
 			'pwd' => '123456',
 			'pwd_repeat' => '123456'
 		];
-		$user->accessible('*', false); // Mark all properties as protected
-		$user->accessible(['id'], true); // Allow id to be accessible by default
+		$user->setAccess('*', false); // Mark all properties as protected
+		$user->setAccess(['id'], true); // Allow id to be accessible by default
 		$user = $this->Users->patchEntity($user, $data, ['fields' => ['id']]);
 
 		$this->assertNotSame($is['password'], $user['password']);
-		$this->assertTrue($user->dirty('pwd'));
+		$this->assertTrue($user->isDirty('pwd'));
 
 		$is = $this->Users->save($user);
 		$this->assertTrue((bool)$is);
@@ -517,8 +517,8 @@ class PasswordableBehaviorTest extends TestCase {
 			'pwd' => 'somepwd',
 			'pwd_repeat' => 'somepwd'
 		];
-		$user->accessible('*', false); // Mark all properties as protected
-		$user->accessible(['id'], true);
+		$user->setAccess('*', false); // Mark all properties as protected
+		$user->setAccess(['id'], true);
 		$this->Users->patchEntity($user, $data, ['fields' => ['id']]);
 		$result = $this->Users->save($user);
 		$this->assertTrue((bool)$result);
@@ -541,8 +541,8 @@ class PasswordableBehaviorTest extends TestCase {
 			'pwd' => 'somepwd',
 			'pwd_repeat' => 'somepwd'
 		];
-		$user->accessible('*', false); // Mark all properties as protected
-		$user->accessible(['id'], true);
+		$user->setAccess('*', false); // Mark all properties as protected
+		$user->setAccess(['id'], true);
 		$user = $this->Users->patchEntity($user, $data);
 		$result = $this->Users->save($user);
 		$this->assertTrue((bool)$result);
@@ -696,7 +696,7 @@ class PasswordableBehaviorTest extends TestCase {
 		$expected = [
 			'pwd' => ['between' => __d('tools', 'valErrBetweenCharacters {0} {1}', 3, 6)],
 		];
-		$this->assertEquals($expected, $user->errors());
+		$this->assertEquals($expected, $user->getErrors());
 	}
 
 	/**
@@ -758,7 +758,7 @@ class PasswordableBehaviorTest extends TestCase {
 		$is = $this->Users->save($user);
 		$this->assertFalse($is);
 
-		$result = $user->errors();
+		$result = $user->getErrors();
 		$expected = ['pwd' => ['validateCustom' => 'Foo Bar']];
 		$this->assertSame($expected, $result);
 
@@ -771,7 +771,7 @@ class PasswordableBehaviorTest extends TestCase {
 		$is = $this->Users->save($user);
 		$this->assertFalse($is);
 
-		$result = $user->errors();
+		$result = $user->getErrors();
 		$expected = ['pwd' => ['validateCustomExt' => 'Foo Bar Ext']];
 		$this->assertSame($expected, $result);
 

+ 9 - 9
tests/TestCase/Model/Behavior/SluggedBehaviorTest.php

@@ -72,7 +72,7 @@ class SluggedBehaviorTest extends TestCase {
 	 * @return void
 	 */
 	public function testAddUnique() {
-		$this->articles->behaviors()->Slugged->config(['unique' => true]);
+		$this->articles->behaviors()->Slugged->setConfig(['unique' => true]);
 
 		$entity = $this->_getEntity();
 		$result = $this->articles->save($entity);
@@ -90,7 +90,7 @@ class SluggedBehaviorTest extends TestCase {
 	public function testAddUniqueMultipleLabels() {
 		/** @var \Tools\Model\Behavior\SluggedBehavior $sluggedBehavior */
 		$sluggedBehavior = $this->articles->behaviors()->Slugged;
-		//$this->articles->behaviors()->Slugged->config('label', ''); // Hack necessary right now to avoid title showing up twice
+		//$this->articles->behaviors()->Slugged->setConfig('label', ''); // Hack necessary right now to avoid title showing up twice
 		$sluggedBehavior->configShallow(['mode' => 'ascii', 'unique' => true, 'label' => ['title', 'long_title']]);
 
 		$entity = $this->_getEntity(null, null, ['long_title' => 'blae']);
@@ -145,13 +145,13 @@ class SluggedBehaviorTest extends TestCase {
 	 * @return void
 	 */
 	public function testLengthRestrictionManual() {
-		$this->articles->behaviors()->Slugged->config(['length' => 155]);
+		$this->articles->behaviors()->Slugged->setConfig(['length' => 155]);
 		$entity = $this->_getEntity(str_repeat('foo bar ', 31));
 
 		$result = $this->articles->save($entity);
 		$this->assertEquals(155, strlen($result->get('slug')));
 
-		$this->articles->behaviors()->Slugged->config(['length' => 10, 'mode' => 'ascii']);
+		$this->articles->behaviors()->Slugged->setConfig(['length' => 10, 'mode' => 'ascii']);
 		$entity = $this->_getEntity('ä ö ü ä ö ü');
 		$result = $this->articles->save($entity);
 		$this->assertEquals('ae-oe-ue-a', $result->get('slug'));
@@ -202,7 +202,7 @@ class SluggedBehaviorTest extends TestCase {
 		$result = $this->articles->save($entity);
 		$this->assertEquals('Some-title', $result->get('slug'));
 
-		$this->articles->behaviors()->Slugged->config(['overwrite' => true]);
+		$this->articles->behaviors()->Slugged->setConfig(['overwrite' => true]);
 		// Now it can modify the slug
 		$entity = $this->articles->patchEntity($entity, ['title' => 'Some really other title']);
 		$result = $this->articles->needsSlugUpdate($entity);
@@ -264,7 +264,7 @@ class SluggedBehaviorTest extends TestCase {
 	 * @return void
 	 */
 	public function testLengthRestrictionNoLimit() {
-		$this->articles->behaviors()->Slugged->config(['length' => 0, 'label' => 'long_title', 'field' => 'long_slug']);
+		$this->articles->behaviors()->Slugged->setConfig(['length' => 0, 'label' => 'long_title', 'field' => 'long_slug']);
 		$entity = $this->_getEntity(str_repeat('foo bar ', 100), 'long_title');
 
 		$result = $this->articles->save($entity);
@@ -321,7 +321,7 @@ class SluggedBehaviorTest extends TestCase {
 	public function testDuplicateWithLengthRestriction() {
 		$this->skipIf(true);
 
-		$this->articles->behaviors()->Slugged->config(['length' => 10, 'unique' => true]);
+		$this->articles->behaviors()->Slugged->setConfig(['length' => 10, 'unique' => true]);
 
 		$article = $this->articles->newEntity(['title' => 'Andy Dawson']);
 		$this->articles->save($article);
@@ -382,7 +382,7 @@ class SluggedBehaviorTest extends TestCase {
 	 * @return void
 	 */
 	public function testTruncateMultibyte() {
-		$this->articles->behaviors()->Slugged->config(['length' => 16]);
+		$this->articles->behaviors()->Slugged->setConfig(['length' => 16]);
 
 		$result = $this->articles->generateSlug('モデルのデータベースとデータソース');
 		$expected = 'モデルのデータベースとデータソー';
@@ -395,7 +395,7 @@ class SluggedBehaviorTest extends TestCase {
 	 * @return void
 	 */
 	public function testUrlMode() {
-		$this->articles->behaviors()->Slugged->config(['mode' => 'url', 'replace' => false]);
+		$this->articles->behaviors()->Slugged->setConfig(['mode' => 'url', 'replace' => false]);
 
 		$string = 'standard string';
 		$expected = 'standard-string';

+ 1 - 1
tests/TestCase/Model/Behavior/StringBehaviorTest.php

@@ -49,7 +49,7 @@ class StringBehaviorTest extends TestCase {
 	 * @return void
 	 */
 	public function testMultipleFieldsAndMultipleFilters() {
-		$this->Comments->behaviors()->String->config(['fields' => ['title', 'comment'], 'input' => ['strtolower', 'ucwords']]);
+		$this->Comments->behaviors()->String->setConfig(['fields' => ['title', 'comment'], 'input' => ['strtolower', 'ucwords']]);
 
 		$data = [
 			'title' => 'some nAme',

+ 6 - 6
tests/TestCase/Model/Table/TableTest.php

@@ -471,7 +471,7 @@ class TableTest extends TestCase {
 	 * @return void
 	 */
 	public function testValidateUnique() {
-		$this->Posts->validator()->add('title', [
+		$this->Posts->getValidator()->add('title', [
 			'validateUnique' => [
 				'rule' => 'validateUniqueExt',
 				'message' => 'valErrRecordTitleExists',
@@ -484,15 +484,15 @@ class TableTest extends TestCase {
 			'published' => 'N'
 		];
 		$post = $this->Posts->newEntity($data);
-		$this->assertEmpty($post->errors());
+		$this->assertEmpty($post->getErrors());
 
 		$res = $this->Posts->save($post);
 		$this->assertTrue((bool)$res);
 
 		$post = $this->Posts->newEntity($data);
-		$this->assertNotEmpty($post->errors());
+		$this->assertNotEmpty($post->getErrors());
 
-		$this->Posts->validator()->add('title', [
+		$this->Posts->getValidator()->add('title', [
 			'validateUnique' => [
 				'rule' => ['validateUniqueExt', ['scope' => ['published']]],
 				'message' => 'valErrRecordTitleExists',
@@ -505,13 +505,13 @@ class TableTest extends TestCase {
 			'published' => 'Y'
 		];
 		$post = $this->Posts->newEntity($data);
-		$this->assertEmpty($post->errors());
+		$this->assertEmpty($post->getErrors());
 
 		$res = $this->Posts->save($post);
 		$this->assertTrue((bool)$res);
 
 		$post = $this->Posts->newEntity($data);
-		$this->assertNotEmpty($post->errors());
+		$this->assertNotEmpty($post->getErrors());
 	}
 
 }

+ 4 - 3
tests/TestCase/View/Helper/HtmlHelperTest.php

@@ -3,7 +3,8 @@
 namespace Tools\Test\TestCase\View\Helper;
 
 use Cake\Core\Plugin;
-use Cake\Network\Request;
+use Cake\Http\ServerRequest;
+use Cake\Routing\RouteBuilder;
 use Cake\Routing\Router;
 use Cake\View\View;
 use Tools\TestSuite\TestCase;
@@ -26,7 +27,7 @@ class HtmlHelperTest extends TestCase {
 		parent::setUp();
 
 		$this->Html = new HtmlHelper(new View(null));
-		$this->Html->request = new Request();
+		$this->Html->request = new ServerRequest();
 		$this->Html->request->webroot = '';
 		$this->Html->Url->request = $this->Html->request;
 	}
@@ -60,7 +61,7 @@ class HtmlHelperTest extends TestCase {
 		$this->Html->request->params['prefix'] = 'admin';
 		Router::reload();
 		Router::connect('/:controller/:action/*');
-		Router::prefix('admin', function ($routes) {
+		Router::prefix('admin', function (RouteBuilder $routes) {
 			$routes->connect('/:controller/:action/*');
 		});
 

+ 1 - 1
tests/TestCase/View/Helper/TreeHelperTest.php

@@ -48,7 +48,7 @@ class TreeHelperTest extends TestCase {
 
 		//$this->Table->truncate();
 		$connection = ConnectionManager::get('test');
-		$sql = $this->Table->schema()->truncateSql($connection);
+		$sql = $this->Table->getSchema()->truncateSql($connection);
 		foreach ($sql as $snippet) {
 			$connection->execute($snippet);
 		}

+ 7 - 6
tests/TestCase/View/Helper/UrlHelperTest.php

@@ -3,7 +3,8 @@
 namespace Tools\Test\TestCase\View\Helper;
 
 use Cake\Core\Plugin;
-use Cake\Network\Request;
+use Cake\Http\ServerRequest;
+use Cake\Routing\RouteBuilder;
 use Cake\Routing\Router;
 use Cake\View\View;
 use Tools\TestSuite\TestCase;
@@ -26,7 +27,7 @@ class UrlHelperTest extends TestCase {
 		parent::setUp();
 
 		$this->Url = new UrlHelper(new View(null));
-		$this->Url->request = new Request();
+		$this->Url->request = new ServerRequest();
 		$this->Url->request->webroot = '';
 	}
 
@@ -44,7 +45,7 @@ class UrlHelperTest extends TestCase {
 		$this->Url->request->params['prefix'] = 'admin';
 		Router::reload();
 		Router::connect('/:controller/:action/*');
-		Router::prefix('admin', function ($routes) {
+		Router::prefix('admin', function (RouteBuilder $routes) {
 			$routes->fallbacks();
 		});
 		Router::pushRequest($this->Url->request);
@@ -77,11 +78,11 @@ class UrlHelperTest extends TestCase {
 		$this->Url->request->params['plugin'] = 'Foo';
 		Router::reload();
 		Router::connect('/:controller/:action/*');
-		Router::plugin('Foo', function ($routes) {
+		Router::plugin('Foo', function (RouteBuilder $routes) {
 			$routes->fallbacks();
 		});
-		Router::prefix('admin', function ($routes) {
-			$routes->plugin('Foo', function ($routes) {
+		Router::prefix('admin', function (RouteBuilder $routes) {
+			$routes->plugin('Foo', function (RouteBuilder $routes) {
 				$routes->fallbacks();
 			});
 		});

+ 1 - 1
tests/test_app/Model/Table/ResetCommentsTable.php

@@ -12,7 +12,7 @@ class ResetCommentsTable extends Table {
 	 * @return void
 	 */
 	public function initialize(array $config) {
-		$this->displayField('comment');
+		$this->setDisplayField('comment');
 		parent::initialize($config);
 	}