forked from lecterror/cakephp-filter-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'lecterror:master' into master
- Loading branch information
Showing
10 changed files
with
116 additions
and
111 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
|
||
class Document extends CakeTestModel | ||
{ | ||
public $name = 'Document'; | ||
public $belongsTo = array('DocumentCategory'); | ||
public $hasMany = array('Item'); | ||
public $hasOne = array('Metadata'); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
|
||
class Document2 extends CakeTestModel | ||
{ | ||
public $name = 'Document'; | ||
public $alias = 'Document'; | ||
public $belongsTo = array('DocumentCategory'); | ||
public $hasMany = array('Item'); | ||
|
||
public $returnValue = false; | ||
|
||
public function beforeDataFilter($query, $options) | ||
{ | ||
return $this->returnValue; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
class Document3 extends CakeTestModel | ||
{ | ||
public $name = 'Document'; | ||
public $alias = 'Document'; | ||
public $belongsTo = array('DocumentCategory'); | ||
public $hasMany = array('Item'); | ||
|
||
public $itemToUnset = null; | ||
|
||
public function afterDataFilter($query, $options) | ||
{ | ||
if (!is_string($this->itemToUnset)) | ||
{ | ||
return $query; | ||
} | ||
|
||
if (isset($query['conditions'][$this->itemToUnset])) | ||
{ | ||
unset($query['conditions'][$this->itemToUnset]); | ||
} | ||
|
||
return $query; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?php | ||
|
||
class DocumentCategory extends CakeTestModel | ||
{ | ||
public $name = 'DocumentCategory'; | ||
public $hasMany = array('Document'); | ||
|
||
public function customSelector($options = array()) | ||
{ | ||
$options['conditions']['DocumentCategory.title LIKE'] = '%T%'; | ||
$options['nofilter'] = true; | ||
|
||
return $this->find('list', $options); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
|
||
App::uses('Controller', 'Controller'); | ||
|
||
class DocumentTestsController extends Controller | ||
{ | ||
public $name = 'DocumentTests'; | ||
|
||
public function index() | ||
{ | ||
} | ||
|
||
// must override this or the tests never complete.. | ||
// @TODO: mock partial? | ||
public function redirect($url, $status = null, $exit = true) | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?php | ||
|
||
class Item extends CakeTestModel | ||
{ | ||
public $name = 'Item'; | ||
public $belongsTo = array('Document'); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?php | ||
|
||
class Metadata extends CakeTestModel | ||
{ | ||
public $name = 'Metadata'; | ||
public $hasOne = array('Document'); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters