Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: Soufianeterhzaz/common
base: b08559e843
...
head fork: gourmet/common
compare: 09bd89cf41
  • 14 commits
  • 31 files changed
  • 0 commit comments
  • 1 contributor
Showing with 72 additions and 49 deletions.
  1. +2 −2 .semver
  2. +6 −5 Controller/CommonAppController.php
  3. +6 −6 Lib/Reveal.php
  4. +2 −1  Test/Case/Model/Behavior/DetailableBehaviorTest.php
  5. +1 −1  Test/Case/Model/Behavior/StateableBehaviorTest.php
  6. +5 −5 Test/Fixture/CommonDetailModelFixture.php
  7. +1 −1  Test/Fixture/CommonTestAuthorizableCompaniesUserFixture.php
  8. +1 −1  Test/Fixture/CommonTestAuthorizableCompanyFixture.php
  9. +1 −1  Test/Fixture/CommonTestAuthorizableDepartmentFixture.php
  10. +1 −1  Test/Fixture/CommonTestAuthorizableDocFixture.php
  11. +1 −1  Test/Fixture/CommonTestAuthorizableDocsGroupFixture.php
  12. +1 −1  Test/Fixture/CommonTestAuthorizableGroupFixture.php
  13. +1 −1  Test/Fixture/CommonTestAuthorizableGroupedUserFixture.php
  14. +1 −1  Test/Fixture/CommonTestAuthorizableGroupsGroupedUserFixture.php
  15. +1 −1  Test/Fixture/CommonTestAuthorizableRecordFixture.php
  16. +1 −1  Test/Fixture/CommonTestAuthorizableUserFixture.php
  17. +1 −1  Test/Fixture/CommonTestCommentableCommentFixture.php
  18. +1 −1  Test/Fixture/CommonTestCommentablePostFixture.php
  19. +1 −1  Test/Fixture/CommonTestCommentableUserFixture.php
  20. +1 −1  Test/Fixture/CommonTestComputableInvoiceFixture.php
  21. +1 −1  Test/Fixture/CommonTestComputableUserFixture.php
  22. +1 −1  Test/Fixture/CommonTestConfirmableUserFixture.php
  23. +1 −1  Test/Fixture/CommonTestDetailableUserFixture.php
  24. +1 −1  Test/Fixture/CommonTestDuplicateFixture.php
  25. +1 −1  Test/Fixture/CommonTestFilterableUserFixture.php
  26. +24 −5 Test/Fixture/CommonTestOpauthUserFixture.php
  27. +1 −1  Test/Fixture/CommonTestOriginalFixture.php
  28. +1 −1  Test/Fixture/CommonTestStateableInvalidFixture.php
  29. +3 −1 Test/Fixture/CommonTestStateableInvoiceFixture.php
  30. +1 −1  Test/Fixture/CommonTestStateableUserFixture.php
  31. +1 −1  VERSION
View
4 .semver
@@ -1,6 +1,6 @@
---
:major: 0
-:minor: 2
-:patch: 5
+:minor: 3
+:patch: 0
:special: ''
:metadata: ''
View
11 Controller/CommonAppController.php
@@ -147,20 +147,21 @@ public function alert($msg, $options = array()) {
$params = array('code' => $options['code'], 'plugin' => $options['plugin']);
// View element
- $element = explode('/', $options['element']);
+ $element = $options['element'];
if (!empty($this->params['prefix'])) {
+ $element = explode('/', $options['element']);
array_push($element, $this->params['prefix'] . '_' . array_pop($element));
+ $element = implode('/', $element);
}
-
- $elementPath = 'View' . DS . 'Elements' . DS . implode('/', $element) . '.ctp';
+
+ $elementPath = 'View' . DS . 'Elements' . DS . $element . '.ctp';
if (!empty($options['plugin']) && CakePlugin::loaded($options['plugin'])) {
+ $element = $options['plugin'] . '.' . $element;
$elementPath = CakePlugin::path($options['plugin']) . $elementPath;
}
if (!is_file($elementPath)) {
$element = $defaults['element'];
- } else {
- $element = implode('/', $element);
}
// Redirect URL
View
12 Lib/Reveal.php
@@ -278,7 +278,7 @@ public static function reload() {
return;
}
foreach (self::$_initialState as $key => $val) {
- if ($key != '_initialState') {
+ if ($key != '_initialState' && isset(self::${$key})) {
self::${$key} = $val;
}
}
@@ -467,9 +467,9 @@ private static function __isPageFront() {
$params = Router::getParams();
return (
- 'pages' == $params['controller']
- && 'display' == $params['action']
- && in_array('home', $params['pass'])
+ !empty($params['controller']) && 'pages' == $params['controller']
+ && !empty($params['action']) && 'display' == $params['action']
+ && !empty($params['pass']) && in_array('home', (array) $params['pass'])
);
}
@@ -482,8 +482,8 @@ private static function __isPageLogin() {
$params = Router::getParams();
return (
- 'users' == $params['controller']
- && 'login' == $params['action']
+ !empty($params['controller']) && 'users' == $params['controller']
+ && !empty($params['action']) && 'login' == $params['action']
);
}
View
3  Test/Case/Model/Behavior/DetailableBehaviorTest.php
@@ -29,6 +29,7 @@ class DetailableBehaviorTest extends CommonTestCase {
* {@inheritdoc}
*/
public $fixtures = array(
+ 'plugin.common.common_detail_model',
'plugin.common.common_test_detailable_user',
);
@@ -120,7 +121,7 @@ public function testAfterSave() {
$this->assertEqual($result, $expected);
$data = array(
- $this->User->alias => array('id' => 1),
+ $this->User->alias => array('id' => '1'),
$detailModel => array('user' => array('fname' => 'test', 'lname' => 'example'))
);
View
2  Test/Case/Model/Behavior/StateableBehaviorTest.php
@@ -126,7 +126,7 @@ public function testCallOnChange() {
// Do not validate `is_paid` state value.
$this->Invoice->id = 2;
- $result = $this->Invoice->changeIsPaid('paid', false);
+ $result = $this->Invoice->changeIsPaid(3, false);
$this->assertTrue($result);
$this->assertEqual($this->Invoice->id, 2);
View
10 Test/Fixture/CommonDetailModelFixture.php
@@ -3,7 +3,7 @@
* CommonDetailModelFixture
*
*/
-class CommonDetailModelFixture extends CakeTestFixture {
+class CommonDetailModelFixture extends CommonTestFixture {
/**
* {@inheritdoc}
@@ -14,10 +14,10 @@ class CommonDetailModelFixture extends CakeTestFixture {
'foreign_model' => array('type' => 'string', 'null' => false, 'default' => NULL, 'length' => 36),
'position' => array('type' => 'integer', 'null' => false, 'default' => 1000, 'length' => 4),
'field' => array('type' => 'string', 'null' => false, 'default' => NULL, 'length' => 255),
- 'value' => array('type' => 'text', 'null' => false, 'default' => NULL),
- 'input' => array('type' => 'string', 'null' => false, 'default' => NULL, 'length' => 16),
- 'data_type' => array('type' => 'string', 'null' => false, 'default' => NULL, 'length' => 16),
- 'label' => array('type' => 'string', 'null' => false, 'default' => NULL, 'length' => 128),
+ 'value' => array('type' => 'text', 'null' => true, 'default' => NULL),
+ 'input' => array('type' => 'string', 'null' => true, 'default' => NULL, 'length' => 16),
+ 'data_type' => array('type' => 'string', 'null' => true, 'default' => NULL, 'length' => 16),
+ 'label' => array('type' => 'string', 'null' => true, 'default' => NULL, 'length' => 128),
'created' => array('type' => 'datetime', 'null' => false, 'default' => NULL),
'modified' => array('type' => 'datetime', 'null' => false, 'default' => NULL),
'indexes' => array(
View
2  Test/Fixture/CommonTestAuthorizableCompaniesUserFixture.php
@@ -3,7 +3,7 @@
* CommonTestAuthorizableCompaniesUserFixture
*
*/
-class CommonTestAuthorizableCompaniesUserFixture extends CakeTestFixture {
+class CommonTestAuthorizableCompaniesUserFixture extends CommonTestFixture {
/**
* {@inheritdoc}
View
2  Test/Fixture/CommonTestAuthorizableCompanyFixture.php
@@ -3,7 +3,7 @@
* CommonTestAuthorizableCompanyFixture
*
*/
-class CommonTestAuthorizableCompanyFixture extends CakeTestFixture {
+class CommonTestAuthorizableCompanyFixture extends CommonTestFixture {
/**
* {@inheritdoc}
View
2  Test/Fixture/CommonTestAuthorizableDepartmentFixture.php
@@ -3,7 +3,7 @@
* CommonTestAuthorizableDepartmentFixture
*
*/
-class CommonTestAuthorizableDepartmentFixture extends CakeTestFixture {
+class CommonTestAuthorizableDepartmentFixture extends CommonTestFixture {
/**
* {@inheritdoc}
View
2  Test/Fixture/CommonTestAuthorizableDocFixture.php
@@ -3,7 +3,7 @@
* CommonTestAuthorizableDocFixture
*
*/
-class CommonTestAuthorizableDocFixture extends CakeTestFixture {
+class CommonTestAuthorizableDocFixture extends CommonTestFixture {
/**
* {@inheritdoc}
View
2  Test/Fixture/CommonTestAuthorizableDocsGroupFixture.php
@@ -3,7 +3,7 @@
* CommonTestAuthorizableDocsGroupFixture
*
*/
-class CommonTestAuthorizableDocsGroupFixture extends CakeTestFixture {
+class CommonTestAuthorizableDocsGroupFixture extends CommonTestFixture {
/**
* {@inheritdoc}
View
2  Test/Fixture/CommonTestAuthorizableGroupFixture.php
@@ -3,7 +3,7 @@
* CommonTestAuthorizableGroupFixture
*
*/
-class CommonTestAuthorizableGroupFixture extends CakeTestFixture {
+class CommonTestAuthorizableGroupFixture extends CommonTestFixture {
/**
* {@inheritdoc}
View
2  Test/Fixture/CommonTestAuthorizableGroupedUserFixture.php
@@ -3,7 +3,7 @@
* CommonTestAuthorizableGroupedUserFixture
*
*/
-class CommonTestAuthorizableGroupedUserFixture extends CakeTestFixture {
+class CommonTestAuthorizableGroupedUserFixture extends CommonTestFixture {
/**
* {@inheritdoc}
View
2  Test/Fixture/CommonTestAuthorizableGroupsGroupedUserFixture.php
@@ -3,7 +3,7 @@
* CommonTestAuthorizableGroupsGroupedUserFixture
*
*/
-class CommonTestAuthorizableGroupsGroupedUserFixture extends CakeTestFixture {
+class CommonTestAuthorizableGroupsGroupedUserFixture extends CommonTestFixture {
/**
* {@inheritdoc}
View
2  Test/Fixture/CommonTestAuthorizableRecordFixture.php
@@ -3,7 +3,7 @@
* CommonTestAuthorizableRecordFixture
*
*/
-class CommonTestAuthorizableRecordFixture extends CakeTestFixture {
+class CommonTestAuthorizableRecordFixture extends CommonTestFixture {
/**
* {@inheritdoc}
View
2  Test/Fixture/CommonTestAuthorizableUserFixture.php
@@ -3,7 +3,7 @@
* CommonTestAuthorizableUserFixture
*
*/
-class CommonTestAuthorizableUserFixture extends CakeTestFixture {
+class CommonTestAuthorizableUserFixture extends CommonTestFixture {
/**
* {@inheritdoc}
View
2  Test/Fixture/CommonTestCommentableCommentFixture.php
@@ -3,7 +3,7 @@
* CommonTestCommentableCommentFixture
*
*/
-class CommonTestCommentableCommentFixture extends CakeTestFixture {
+class CommonTestCommentableCommentFixture extends CommonTestFixture {
/**
* {@inheritdoc}
View
2  Test/Fixture/CommonTestCommentablePostFixture.php
@@ -3,7 +3,7 @@
* CommonTestCommentablePostFixture
*
*/
-class CommonTestCommentablePostFixture extends CakeTestFixture {
+class CommonTestCommentablePostFixture extends CommonTestFixture {
/**
* {@inheritdoc}
View
2  Test/Fixture/CommonTestCommentableUserFixture.php
@@ -3,7 +3,7 @@
* CommonTestCommentableUserFixture
*
*/
-class CommonTestCommentableUserFixture extends CakeTestFixture {
+class CommonTestCommentableUserFixture extends CommonTestFixture {
/**
* {@inheritdoc}
View
2  Test/Fixture/CommonTestComputableInvoiceFixture.php
@@ -3,7 +3,7 @@
* CommonTestComputableInvoiceFixture
*
*/
-class CommonTestComputableInvoiceFixture extends CakeTestFixture {
+class CommonTestComputableInvoiceFixture extends CommonTestFixture {
/**
* {@inheritdoc}
View
2  Test/Fixture/CommonTestComputableUserFixture.php
@@ -3,7 +3,7 @@
* CommonTestComputableUserFixture
*
*/
-class CommonTestComputableUserFixture extends CakeTestFixture {
+class CommonTestComputableUserFixture extends CommonTestFixture {
/**
* {@inheritdoc}
View
2  Test/Fixture/CommonTestConfirmableUserFixture.php
@@ -3,7 +3,7 @@
* CommonTestConfirmableUserFixture
*
*/
-class CommonTestConfirmableUserFixture extends CakeTestFixture {
+class CommonTestConfirmableUserFixture extends CommonTestFixture {
/**
* {@inheritdoc}
View
2  Test/Fixture/CommonTestDetailableUserFixture.php
@@ -3,7 +3,7 @@
* CommonTestDetailableUserFixture
*
*/
-class CommonTestDetailableUserFixture extends CakeTestFixture {
+class CommonTestDetailableUserFixture extends CommonTestFixture {
/**
* {@inheritdoc}
View
2  Test/Fixture/CommonTestDuplicateFixture.php
@@ -3,7 +3,7 @@
* CommonTestDuplicateFixture
*
*/
-class CommonTestDuplicateFixture extends CakeTestFixture {
+class CommonTestDuplicateFixture extends CommonTestFixture {
/**
* {@inheritdoc}
View
2  Test/Fixture/CommonTestFilterableUserFixture.php
@@ -3,7 +3,7 @@
* CommonTestFilterableUserFixture
*
*/
-class CommonTestFilterableUserFixture extends CakeTestFixture {
+class CommonTestFilterableUserFixture extends CommonTestFixture {
/**
* {@inheritdoc}
View
29 Test/Fixture/CommonTestOpauthUserFixture.php
@@ -3,7 +3,7 @@
* CommonTestOpauthUserFixture
*
*/
-class CommonTestOpauthUserFixture extends CakeTestFixture {
+class CommonTestOpauthUserFixture extends CommonTestFixture {
/**
* {@inheritdoc}
@@ -16,8 +16,8 @@ class CommonTestOpauthUserFixture extends CakeTestFixture {
'password' => array('type' => 'string', 'null' => false, 'default' => NULL),
'first_name' => array('type' => 'string', 'null' => false, 'default' => NULL),
'last_name' => array('type' => 'string', 'null' => false, 'default' => NULL),
- 'company' => array('type' => 'string', 'null' => false, 'default' => NULL),
- 'gravatar' => array('type' => 'string', 'null' => false, 'default' => NULL),
+ 'company' => array('type' => 'string', 'null' => true, 'default' => NULL),
+ 'gravatar' => array('type' => 'string', 'null' => true, 'default' => NULL),
'created' => array('type' => 'datetime', 'null' => false, 'default' => NULL),
'modified' => array('type' => 'datetime', 'null' => false, 'default' => NULL),
'indexes' => array(
@@ -26,19 +26,38 @@ class CommonTestOpauthUserFixture extends CakeTestFixture {
),
);
+/**
+ * {@inheritdoc}
+ */
public $records = array(
array(
'id' => 1,
'google_id' => '',
'google_credentials' => '',
- 'email' => 'user@example.com',
+ 'first_name' => 'User',
+ 'last_name' => 'Example',
),
array(
'id' => 2,
'google_id' => '',
'google_credentials' => '',
- 'email' => 'john@doe.com',
+ 'first_name' => 'John',
+ 'last_name' => 'Doe',
),
);
+/**
+ * {@inheritdoc}
+ */
+ public function init() {
+ foreach ($this->records as $k => $record) {
+ $email = strtolower($record['first_name'] . '@' . $record['last_name'] . '.com');
+ $this->records[$k] += array(
+ 'email' => $email,
+ 'password' => md5($email)
+ );
+ }
+ parent::init();
+ }
+
}
View
2  Test/Fixture/CommonTestOriginalFixture.php
@@ -3,7 +3,7 @@
* CommonTestOriginalFixture
*
*/
-class CommonTestOriginalFixture extends CakeTestFixture {
+class CommonTestOriginalFixture extends CommonTestFixture {
/**
* {@inheritdoc}
View
2  Test/Fixture/CommonTestStateableInvalidFixture.php
@@ -3,7 +3,7 @@
* CommonTestStateableInvalidFixture
*
*/
-class CommonTestStateableInvalidFixture extends CakeTestFixture {
+class CommonTestStateableInvalidFixture extends CommonTestFixture {
/**
* {@inheritdoc}
View
4 Test/Fixture/CommonTestStateableInvoiceFixture.php
@@ -3,7 +3,7 @@
* CommonTestStateableInvoiceFixture
*
*/
-class CommonTestStateableInvoiceFixture extends CakeTestFixture {
+class CommonTestStateableInvoiceFixture extends CommonTestFixture {
/**
* {@inheritdoc}
@@ -27,12 +27,14 @@ class CommonTestStateableInvoiceFixture extends CakeTestFixture {
public $records = array(
array(
'id' => 1,
+ 'user_id' => 1,
'status' => 'active',
'is_paid' => 1,
'is_due' => 0,
),
array(
'id' => 2,
+ 'user_id' => 1,
'status' => 'active',
'is_paid' => 0,
'is_due' => 1
View
2  Test/Fixture/CommonTestStateableUserFixture.php
@@ -3,7 +3,7 @@
* CommonTestStateableUserFixture
*
*/
-class CommonTestStateableUserFixture extends CakeTestFixture {
+class CommonTestStateableUserFixture extends CommonTestFixture {
/**
* {@inheritdoc}
View
2  VERSION
@@ -1 +1 @@
-0.2.5
+v0.3.0

No commit comments for this range

Something went wrong with that request. Please try again.