Browse Source

Move files to correct folders

euromark 11 years ago
parent
commit
3cf24584ea

Console/Command/WhitespaceShell.php → src/Console/Command/WhitespaceShell.php


Model/Behavior/SluggedBehavior.php → src/Model/Behavior/SluggedBehavior.php


+ 45 - 0
src/TestSuite/Traits/ToolsTestTrait.php

@@ -0,0 +1,45 @@
+<?php
+namespace Tools\TestSuite\Traits;
+
+use Cake\Controller\Controller;
+use Cake\Network\Response;
+use Cake\Routing\Router;
+
+/**
+ * Utility methods for easier testing in CakePHP & PHPUnit
+ */
+trait ToolsTestTrait {
+
+/**
+ * Assert a redirect happened
+ *
+ * `$actual` can be a string, Controller or Response instance
+ *
+ * @param  string $expected
+ * @param  mixed  $actual
+ * @return void
+ */
+	public function assertRedirect($expected, $actual = null) {
+		if ($actual === null) {
+			$actual = $this->controller;
+		}
+
+		if ($actual instanceof Controller) {
+			$actual = $actual->response->location();
+		}
+
+		if ($actual instanceof Response) {
+			$actual = $actual->location();
+		}
+
+		if (empty($actual)) {
+			throw new \Exception('assertRedirect: Expected "actual" to be a non-empty string');
+		}
+
+		if (is_array($expected)) {
+			$expected = Router::url($expected);
+		}
+		$this->assertEquals($expected, $actual,	'Was not redirected to ' . $expected);
+	}
+
+}

+ 0 - 0
src/Utility/Set.php


Test/Fixture/SluggedArticleFixture.php → tests/Fixture/SluggedArticleFixture.php


Test/TestCase/Console/Command/WhitespaceShellTest.php → tests/TestCase/Console/Command/WhitespaceShellTest.php


Test/TestCase/Model/Behavior/SluggedBehaviorTest.php → tests/TestCase/Model/Behavior/SluggedBehaviorTest.php


+ 4 - 6
Test/bootstrap.php

@@ -17,13 +17,10 @@ function find_root() {
 }
 
 function find_app() {
-	if (is_dir(ROOT . '/App')) {
-		return 'App';
-	}
-
-	if (is_dir(ROOT . '/vendor/cakephp/app/App')) {
-		return 'vendor/cakephp/app/App';
+	if (is_dir(ROOT . '/src')) {
+		return 'src';
 	}
+	return 'App';
 }
 
 define('DS', DIRECTORY_SEPARATOR);
@@ -90,4 +87,5 @@ Cake\Datasource\ConnectionManager::config('test', [
 	'password' => getenv('db_password'),
 	'timezone' => 'UTC',
 	'quoteIdentifiers' => true,
+	'cacheMetadata' => true,
 ]);