get output controller from another controller

2012-04-26 Thread Christophe Vandeplas
Hello, ( using CakePHP 2.1 ) I'm building an application that synchronizes data between different instances of my application. (download and upload) My application is REST enabled and thus I can call controller actions from external applications and get the result in clean xml. However it is not

Re: Testing in Command line, change output error ?

2012-04-26 Thread Điển vũ
I created TestSuite/Reporter/CakeHtmlReporter.php ( copy in original Lib ) then change function _getStackTrace() like this: https://gist.github.com/2504656 then I get stack trace like this New

Re: Pagination

2012-04-26 Thread jeremyharris
So the book belongsTo will look something like this: var $belongsTo = array( 'BillingCity' => array( 'className' => 'City', 'foreignKey' => 'billing_city_id' ), 'MainCity' => array( 'className' => 'City', 'foreignKey' => 'main_city_id' ), 'Author' ); Then your paginati

Re: Pagination

2012-04-26 Thread hill180
You know my example was a different then my actual code (I know I should have just used it) I have two cities per book. IE main_city_id (where it was written) billing_city_id (where the author wants to get paid) How do I distinguish them? I can't use City.name Thanks. On Thu, Apr 26, 2012 at

Re: Testing in Command line, change output error ?

2012-04-26 Thread Điển vũ
I tested in CLI : cake testsuite core Controller/Component/AuthComponent cake testsuite core Controller/Component/SessionComponent It seems AuthComponent, SessionComponent, CookieComponent can't use in CLI But it failed . Do any method contains AuthComponent, SessionComponent, Co

Re: Pagination

2012-04-26 Thread jeremyharris
If it's hasMany then I think your relationship should be: var $hasMany = array( 'Book' => array( 'className' => 'Book', 'foreignKey' => 'city_id', // books table has city_id 'conditions' => '', 'fields' => '', 'order' => ''

Re: Pagination

2012-04-26 Thread hill180
City hasMany books, books only have one author. City.name didn't work var $hasMany = array( 'Book' => array( 'className' => 'Book', 'foreignKey' => 'book_id', 'conditions' => '', 'fields' => '', 'order' => '' )); On Thu,

Re: French accent problem

2012-04-26 Thread Thiago Belem
You're saving the file as UTF-8 too? Regards, -- ***Thiago Belem* Desenvolvedor Rio de Janeiro - RJ - Brasil *Assando Sites* - Curso online de *CakePHP* assando-sites.com.br thiagobelem.net cont...@thiagobelem.net *Skype / gTalk **»* thiago.belem.web *LinkedIn* *»* br.link

French accent problem

2012-04-26 Thread Budd
Hi, I am doing the input form with French label. echo $this->Form->input('content_owner',array('label' => 'Propriétaire du contenu','escape' => false)); But it shows up Propri�taire du contenu on the site. Anybody know how to fix it? I have checked the head tag>>content="text/html; charset=ut

Re: Hide "previous" "next" when no pagination

2012-04-26 Thread Jeremy Burns | Class Outfit
You can also apply css styles to them, and use the right style to set display: none: echo $this->Paginator->first('<<', array('class' => 'arrow'), null, array('class' => 'arrow disabled')); Jeremy Burns Class Outfit http://www.classoutfit.com On 26 Apr 2012, at 19:18:29, jeremyharris wrote:

Re: Hide "previous" "next" when no pagination

2012-04-26 Thread jeremyharris
Try: if ($this->Paginator->counter(array('format' => '%count%')) == 0) { // no records, don't show links! } -jeremy On Thursday, April 26, 2012 9:17:49 AM UTC-7, JonStark wrote: > > How can I hide the "<< Previous Next >>" that appears if there is no > pages to paginate ? > I think this is po

Get the first link of a post ?

2012-04-26 Thread JonStark
I'm currently trying to get the first link of a post for a specific post format, but preg_match needs two parameters and I can't find the second... Here is my code : (...) } else if (($post['Post']['format']) == 'link') { if (preg_match('/]*?href=[\'"](.+?)[\'"]/is')a) { return $firstLink; } el

Hide "previous" "next" when no pagination

2012-04-26 Thread JonStark
How can I hide the "<< Previous Next >>" that appears if there is no pages to paginate ? I think this is possible because the numbers do not appear when not needed. Thanks a lot ! -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Que

Re: Mock and test uploads

2012-04-26 Thread jeremyharris
I would take cues from the Media plugin, which uses binary data in some of its testing library. Test data: https://github.com/davidpersson/media/blob/next/tests/fixtures/test_data.php Where test data is set up: https://github.com/davidpersson/media/blob/next/tests/cases/models/behaviors/base.te

Mock and test uploads

2012-04-26 Thread Thiago Belem
I'm creating a new MeioUpload/Media behavior and I wanted to make it totally covered by tests... Do you guys have any idea/recomendation/resource about mocking uploads on CakePHP + PHPUnit? I know I can't just populate $_FILES with my data and expect is_uploaded_file or move_uploaded_file functio

Re: Pagination

2012-04-26 Thread jeremyharris
Is City a hasOne or belongsTo relationship? If so, and your find code is using contain or recursive to include those in the results, you can do this: $this->Paginator->sort('Where Written', 'City.name'); Check your data and SQL queries to see if it's joined that way. On Wednesday, April 25, 201

Re: Testing in Command line, change output error ?

2012-04-26 Thread jeremyharris
You can run it in the CLI and it should work fine. As for changing the warning, I'm not sure what you're looking for. Is it the styling or how the report is generated that you don't like? If it's the styling, then use CSS. If it's the report itself, I think theoretically you can change it by cr

Re: Mock testing , don't save data.

2012-04-26 Thread jeremyharris
Rodrigo is right. By mocking the save method you are basically saying that that method does nothing, unless you specify a return value. Mocking the save method is probably not the way to go. If you're using a test database and fixtures, the data will be stored in a database and wiped clean when

Re: Mock testing , don't save data.

2012-04-26 Thread Rodrigo Rodrigues Moyle
If you use a mock on model, the data is not saved to database and the findByGuest is always false. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related que

How to call element to element

2012-04-26 Thread nikunj kansara
Hello, I want to call one elements to another elements example : I have view/elements/view.ctp i want to call another element from view.ctp How can i do that? -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://

Mock testing , don't save data.

2012-04-26 Thread Điển vũ
$Posts = $this->generate('Posts', array( 'models' => array('Post' => array('save')) )); $Posts->Post->expects($this->any())->method('save'); $this->testAction('/user/posts/add', array( 'data' => array( 'Post' => array(

Re: QuickApps and Croogo

2012-04-26 Thread kani
Tnx for your replay. On Wednesday, April 25, 2012 5:59:10 PM UTC+8, kani wrote: > > What is diffrence and how compatible with cakephp core. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and he