Re: cakePHP 3.0.0-RC2 documentation, Testing

2015-02-11 Thread Lorne Dudley
This is line 15 in ProgressHelperTest.php, within function setUp()
   $this->Progress = new ProgressHelper($View);

On Wednesday, February 11, 2015 at 9:06:29 PM UTC-5, Lorne Dudley wrote:
>
> Testing  (page 559 in the pdf version)
>
> I am attempting to follow the instructions in the 3.0.0-RC2 document, 
> current as of today.
>
> I believe I have followed all of the instructions.
>
> This is my setup.  (cakePHP 3.0.0-RC2, updated as of today)
>
>
> E:/web/cake3-rc2/vendor/cakephp/bake/tests/TestCase/View/Helper/ProgressHelperTest.php
>
> E:/web/cake3-rc2/vendor/cakephp/bake/src/View/Helper/ProgressHelper.php
>
> E:\web\cake3-rc2\vendor\cakephp\bake> phpunit 
> E:/web/cake3-rc2/vendor/cakephp/bake/tests/TestCase/View/Helper/ProgressHelperTest.php
> PHPUnit 4.5.0 by Sebastian Bergmann and contributors.
>
> Configuration read from 
> E:\web\cake3-rc2\vendor\cakephp\bake\phpunit.xml.dist
>
> Fatal error: Class 'App\View\Helper\ProgressHelper' not found in 
> E:\web\cake3-rc2\vendor\cakephp\bake\tests\TestCase\View\Helper\ProgressHelperTest.php
>  
> on line 15
>
> Call Stack:
> 0. 120448   1. {main}() C:\xampp2\php\phpunit:0
> 0.0156 355992   2. PHPUnit_TextUI_Command::main() 
> C:\xampp2\php\phpunit:46
> 0.0156 359392   3. PHPUnit_TextUI_Command->run() 
> C:\xampp2\php\pear\PHPUnit\TextUI\Command.php:129
> 0.09362429736   4. PHPUnit_TextUI_TestRunner->doRun() 
> C:\xampp2\php\pear\PHPUnit\TextUI\Command.php:176
> 0.10922750216   5. PHPUnit_Framework_TestSuite->run() 
> E:\web\cake3-rc2\vendor\phpunit\phpunit\src\TextUI\TestRunner.php:398
> 0.10922761344   6. PHPUnit_Framework_TestCase->run() 
> E:\web\cake3-rc2\vendor\phpunit\phpunit\src\Framework\TestSuite.php:716
> 0.10922762088   7. PHPUnit_Framework_TestResult->run() 
> E:\web\cake3-rc2\vendor\phpunit\phpunit\src\Framework\TestCase.php:693
> 0.12482817952   8. PHPUnit_Framework_TestCase->runBare() 
> E:\web\cake3-rc2\vendor\phpunit\phpunit\src\Framework\TestResult.php:609
> 0.12482909168   9. 
> App\Test\TestCase\View\Helper\ProgressHelperTest->setUp() 
> E:\web\cake3-rc2\vendor\phpunit\phpunit\src\Framework\TestCase.php:733
>   
> My question:  
>
> How do I fix this so that the documented test works ?
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


cakePHP 3.0.0-RC2 documentation, Testing

2015-02-11 Thread Lorne Dudley
Testing  (page 559 in the pdf version)

I am attempting to follow the instrucions in the 3.0.0-RC2 document, 
current as of today.

I believe I have followed all of the instructions.

This is my setup.  (cakePHP 3.0.0-RC2, updated as of today)

E:/web/cake3-rc2/vendor/cakephp/bake/tests/TestCase/View/Helper/ProgressHelperTest.php

E:/web/cake3-rc2/vendor/cakephp/bake/src/View/Helper/ProgressHelper.php

E:\web\cake3-rc2\vendor\cakephp\bake> phpunit 
E:/web/cake3-rc2/vendor/cakephp/bake/tests/TestCase/View/Helper/ProgressHelperTest.php
PHPUnit 4.5.0 by Sebastian Bergmann and contributors.

Configuration read from 
E:\web\cake3-rc2\vendor\cakephp\bake\phpunit.xml.dist

Fatal error: Class 'App\View\Helper\ProgressHelper' not found in 
E:\web\cake3-rc2\vendor\cakephp\bake\tests\TestCase\View\Helper\ProgressHelperTest.php
 
on line 15

Call Stack:
0. 120448   1. {main}() C:\xampp2\php\phpunit:0
0.0156 355992   2. PHPUnit_TextUI_Command::main() 
C:\xampp2\php\phpunit:46
0.0156 359392   3. PHPUnit_TextUI_Command->run() 
C:\xampp2\php\pear\PHPUnit\TextUI\Command.php:129
0.09362429736   4. PHPUnit_TextUI_TestRunner->doRun() 
C:\xampp2\php\pear\PHPUnit\TextUI\Command.php:176
0.10922750216   5. PHPUnit_Framework_TestSuite->run() 
E:\web\cake3-rc2\vendor\phpunit\phpunit\src\TextUI\TestRunner.php:398
0.10922761344   6. PHPUnit_Framework_TestCase->run() 
E:\web\cake3-rc2\vendor\phpunit\phpunit\src\Framework\TestSuite.php:716
0.10922762088   7. PHPUnit_Framework_TestResult->run() 
E:\web\cake3-rc2\vendor\phpunit\phpunit\src\Framework\TestCase.php:693
0.12482817952   8. PHPUnit_Framework_TestCase->runBare() 
E:\web\cake3-rc2\vendor\phpunit\phpunit\src\Framework\TestResult.php:609
0.12482909168   9. 
App\Test\TestCase\View\Helper\ProgressHelperTest->setUp() 
E:\web\cake3-rc2\vendor\phpunit\phpunit\src\Framework\TestCase.php:733
  
My question:  

How do I fix this so that the documented test works ?

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: Loading external vendor's in CakePHP 3

2015-02-11 Thread HVan
Nevermind - I forgot to add use Services_Twilio; at top of the controller.

Duh!

On Wednesday, February 11, 2015 at 2:51:03 PM UTC-8, HVan wrote:
>
> Maybe it's just me but I just can't figure this out. I'm trying to use 
> Twilio (https://github.com/twilio/twilio-php) with Cake 3. I installed 
> via composer. At the top of bootstrap.php it includes vendor/autoload.php, 
> however, no luck; Twilio functions are not called.
>
> So I manually required it inside my controller function and tried calling 
> the class:
>
> require_once(ROOT.'/vendor/twilio/sdk/Services/Twilio.php');
> $client = new Services_Twilio(TWILIO_ACCOUNTSID, TWILIO_AUTHTOKEN);
>
> Again, no work and I get this error: *Error: *Class 
> 'App\Controller\Services_Twilio' not found 
>
> Would appreciate it if someone can point me in the right direction. It 
> really can't be that hard I'm sure. I've used Twilio many times outside of 
> Cake and it was as simple as just requiring it and instantiating the 
> classes.
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Loading external vendor's in CakePHP 3

2015-02-11 Thread HVan
Maybe it's just me but I just can't figure this out. I'm trying to use 
Twilio (https://github.com/twilio/twilio-php) with Cake 3. I installed via 
composer. At the top of bootstrap.php it includes vendor/autoload.php, 
however, no luck; Twilio functions are not called.

So I manually required it inside my controller function and tried calling 
the class:

require_once(ROOT.'/vendor/twilio/sdk/Services/Twilio.php');
$client = new Services_Twilio(TWILIO_ACCOUNTSID, TWILIO_AUTHTOKEN);

Again, no work and I get this error: *Error: *Class 
'App\Controller\Services_Twilio' not found 

Would appreciate it if someone can point me in the right direction. It 
really can't be that hard I'm sure. I've used Twilio many times outside of 
Cake and it was as simple as just requiring it and instantiating the 
classes.

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: CakePHP 2.0 authentication(login) without ctp files but other types

2015-02-11 Thread John Andersen
Ah, I see your problem :)

Please ensure that your users table has at least these columns:
id, username, password

The id column is just the primary key for the table and CakePHP uses the id 
to identify records in the table.

Auth will use the username and password columns to identify the user who 
logs in.

Yes, password should be 40 characters long when using that password hasher.

Please correct your users table and see if it now solves your issue. Please 
also inform back here so other having the same issue may know.

Thanks and enjoy, John


On Wednesday, 11 February 2015 10:06:16 UTC+2, tech_me wrote:
>
> Hi John,
>
> Sorry for replying late.
> I have been very busing recently and have less time to continue on this 
> issue.
>
> Today I make some time to try your solution, got a good result and a bad 
> one:
> - GOOD
> `passwordHasher`, yes, it worked.
> It saved hashed password(123) against id(1001) to my table, which is 
> **f034a6b0709eb2b2bd1b2eb47987ab6e334ca7a6**(40 chars?!)
>
> - BAD
> Nothing changed, `$this->Auth->login()` still returning `false`. 
>
>
> ADDITIONAL
> I have two input elements in my html(with PHPTAL), theirs `name` 
> attributes are `username` and `password`,
> while there are `id` and 'password' fields in my table.
> So
> `
> ...
> 'authenticate' => array(
> 'Form' => array('userModel' => 'User',
> 'fields' => array('username' => 'id',
> 'password' => 'password'))),
> ...
> `
> is there anything incorrect?
>
> Thank you, tech_me
>
> [snip]
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: Cake v2.x -- Looking to return rendered view to the Controller

2015-02-11 Thread BrendonKoz
Just looking at the API code I know that'll work. Ugh. Looking through all 
of the files yesterday I'm surprised I missed it. Thanks, Andrew!!!

On Tuesday, February 10, 2015 at 11:22:28 PM UTC-5, Andrew Lechowicz wrote:
>
> My bad. In typical Cake fashion, a method with the name of the property 
> you want to "get" when passed null returns that property. So my code above 
> should be 
> $emailBody = $this->response->body();
> Note the parentheses. For your reference: 
> http://api.cakephp.org/2.6/source-class-CakeResponse.html#605-617
>
> On Tuesday, February 10, 2015 at 7:44:55 PM UTC-5, BrendonKoz wrote:
>>
>> Thank you for the response, Andrew. In my test (using a view file that 
>> just contains static text), $this->response->body seemed to return an empty 
>> string due to ViewBlock->get having an empty $ViewBlock->_blocks value (as 
>> to what $_blocks is or how it's set, I've no idea).
>>
>> I don't suppose anyone has any other ideas?
>> I've tried switching to using CakeEmail for sending email to take 
>> advantage of layouts and views and there's a bug preventing me from 
>> connecting to my SMTP server's TLS connection (which I have to report), so 
>> neither solution is currently working for me. :-/ Getting templates to work 
>> with a third party library would be easier for me!
>>
>>
>>
>> On Thursday, February 5, 2015 at 4:14:48 PM UTC-5, Andrew Lechowicz wrote:
>>>
>>> It looks like `Controller::render()` sets the body on the CakeResponse 
>>> object and then returns the CakeResponse object: 
>>> http://api.cakephp.org/2.6/source-class-Controller.html#922-962. I 
>>> would imagine you could access the rendered view like so:
>>> public function test()
>>> {
>>> $this->render('/Emails/html/test', false);
>>> $emailBody = $this->response->body;
>>> // Do what you want with $emailBody here
>>> }
>>>
>>>
>>>
>>> On Wednesday, February 4, 2015 at 5:33:35 PM UTC-5, BrendonKoz wrote:

 For various reasons I had decided to use a 3rd party email library 
 within my current CakePHP project. I thought that it might be nice to use 
 CakePHP's Views to create templating for my emails and take advantage of 
 layouts too. Unfortunately I'm stumped on just how to retrieve the 
 rendered 
 output of a view back to the Controller method.

 I've tried the following:

 public function test() {
 $this->layout = false;
 #$this->view = '/Emails/html/test.ctp';
 $var = $this->render('/Emails/html/test', false);
 pr($var->_body); die();
 }

 $var->_body is protected (as denoted by the underscore). I saw no other 
 property within the $var variable that contained the "body" code within my 
 (template) view.

 Are there any ways to do this that I'm just not seeing? If so, can I 
 safely presume that layouts would be handled in a similar fashion?

 Thank you for any possible help...

>>>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: CakePHP 3 Plugin not working (controller file not found)

2015-02-11 Thread HVan
{
"name": "cakephp/app",
"description": "CakePHP skeleton app",
"homepage": "http://cakephp.org";,
"type": "project",
"license": "MIT",
"require": {
"php": ">=5.4.16",
"cakephp/cakephp": "3.0.*-dev",
"mobiledetect/mobiledetectlib": "2.*",
"cakephp/migrations": "dev-master",
"mailgun/mailgun-php": "dev-master",
"twilio/sdk": "dev-master"
},
"require-dev": {
"d11wtq/boris": "1.0.*",
"cakephp/debug_kit": "3.0.*-dev",
"cakephp/bake": "dev-master"
},
"suggest": {
"phpunit/phpunit": "Allows automated tests to be run without 
system-wide install.",
"cakephp/cakephp-codesniffer": "Allows to check the code against 
the coding standards used in CakePHP."
},
"autoload": {
"psr-4": {
"App\\": "src"
}
},
"autoload-dev": {
"psr-4": {
"App\\Test\\": "tests",
"Cake\\Test\\": "./vendor/cakephp/cakephp/tests"
}
},
"scripts": {
"post-install-cmd": "App\\Console\\Installer::postInstall"
},
"minimum-stability" : "dev",
"prefer-stable": true
}

*Thanks!*

On Monday, February 9, 2015 at 6:23:14 PM UTC-8, José Lorenzo wrote:
>
> How does your composer.json file look like?
>
> On Sunday, February 8, 2015 at 11:28:58 AM UTC-4:30, HVan wrote:
>>
>> I followed all the instrucitons, even tried baking a plugin. But each 
>> time I reference the plugin (eg. 
>> http://localhost/contact_manager/contacts) it says Controller not found. 
>> All the files have been created and placed in the proper location. It will 
>> say file not found in 
>> /plugins/ContactManager/src/Controller/ContactsController.php and I've 
>> tripled checked, of course, that the file exists. I also created the Table 
>> file - nada.
>>
>> It's loading the plugin properly because when I remove, say bootstrap.php 
>> inside the plugin, it will say the bootstrap file is not found inside the 
>> plugin.
>>
>> Any ideas?
>>
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: CakePHP 2.0 authentication(login) without ctp files but other types

2015-02-11 Thread tech_me
Hi John,

Sorry for replying late.
I have been very busing recently and have less time to continue on this 
issue.

Today I make some time to try your solution, got a good result and a bad 
one:
- GOOD
`passwordHasher`, yes, it worked.
It saved hashed password(123) against id(1001) to my table, which is 
**f034a6b0709eb2b2bd1b2eb47987ab6e334ca7a6**(40 chars?!)

- BAD
Nothing changed, `$this->Auth->login()` still returning `false`. 


ADDITIONAL
I have two input elements in my html(with PHPTAL), theirs `name` attributes 
are `username` and `password`,
while there are `id` and 'password' fields in my table.
So
`
...
'authenticate' => array(
'Form' => array('userModel' => 'User',
'fields' => array('username' => 'id',
'password' => 'password'))),
...
`
is there anything incorrect?

Thank you, tech_me


On Friday, January 16, 2015 at 2:48:09 AM UTC+9, John Andersen wrote:
>
> You have a users table with two records, where the one with id = 1001 has 
> the password = 123. The password needs to be changed to the hashed value 
> that Auth/password hasher can provide to you.
>
> Make sure that your password column in the table has a definition that can 
> contain a hashed password - think it should be 32 character (please correct 
> me if I am wrong).
>
> As a temporary solution (other may provide a better one :)
>
> In you controller, at the beginning of the login method, add this:
> // Make user 1001 the current in the User model
> $this->User->id = 1001;
>
> // Activate the simple password hasher and hash the password '123'.
>
> $passwordHasher = new SimplePasswordHasher();
> $pw1001 = $passwordHasher->hash('123');
>
>
> // Save the password to the hashed value of 123 for the current user 1001
> $this->User->saveField('password', $pw1001);
>
> Then try to login only once and check your database to see whether or not 
> the password has changed value to something
>
> If the password in the table has changed, then comment out the above code 
> and try to login again using password 123.
>
> Enjoy, John
>
>
> On Thursday, 15 January 2015 16:37:37 UTC+2, tech_me wrote:
>>
>> Hi John,
>>
>> > Use the password hasher to hash your password, then save it instead of 
>> "123" and it should work.
>> So could I put hasshed password to table without create new user record?
>> I have read your link, but there is just creating user...
>>
>> Besides users, lots of tests are able to be tested just by searching but 
>> not creating new record for those purposes.
>>
>> Thanks, tech_me 
>>
>>
>> On Thursday, January 15, 2015 at 5:15:16 AM UTC+9, John Andersen wrote:
>>>
>>> Use the password hasher to hash your password, then save it instead of 
>>> "123" and it should work.
>>>
>>> See the CakePHP book at this location for the password hasher:
>>>
>>> http://book.cakephp.org/2.0/en/core-libraries/components/authentication.html#hashing-passwords
>>>
>>> Enjoy, John
>>>
>>> On Sunday, 11 January 2015 13:52:07 UTC+2, tech_me wrote:

 > If '123' is the actual data in your password field in the data 
 record, it's very likely this is the problem you're having with logging in.
 Maybe this is the problem;)

 [snip]

>>>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.