Jump to content
Larry Ullman's Book Forums

Phpunit, Pear, Selenium


Recommended Posts

Yesterday i experienced the worst day ever, i had to install PEAR, then PHPUnit and lastly Selenium.

 

Well i started out early working through Agile Web Application Development with Yii and PHP. Anyway i got stuck on installing PEAR, then it looked like it installed, and i was working on PHPUnit and that looked like it installed but i was continuously getting errors and fixing errors. After hours and hours of going through online help and getting error after error i got to the point at which there was no more help. I was completely stressed out, i had been working on this for around 5 hours, i had a major headache. I don't know about PEARS, but this was driving me Banana's. I decided after a short break that the best thing would be to reinstall install XAMPP completely, so i downloaded there most up to date version. Finally after i got that installed, i found that PEAR and PHPUnit were already all setup, i was like whall this is just amazing, i spend almost 6 hours messing around and then it all works in one go with the new XAMPP. Well regardless of what happened i did feel satisfied when i finally got it installed after all that time spent.

 

Okay for those of you working through Yii, i have a question, im on page.70 (Agile Web Application Development with Yii and PHP), using PHPUnit to run a test on a ProjectTest.php

 

in command prompt we need to type in

 

% cd Webroot/protected/tests

% phpunit unit/ProjectTest.php in

 

after running this im getting an error

 

Parse error: syntax error, unexpected T_VARIABLE C:\xampp\htdocs\yii\trackstar\protected\tests\unit\ProjectTest.php on line 8

 

here is a copy of ProjectTest.php

 

<?php
class ProjectTest extends CDbTestCase
{
public function testCRUD()
{
 //Create a new project
	$newProject=new Project
		$newProjectName = 'Test Project 1';	 // Line 8
	$newProject->setAttributes(
	 array(
			'name'=> $newProjectName,
						'description' => 'Test project number one',
						'create_time' => '2010-01-01 00:00:00',
						'create_user_id' => 1,
						'update_time' => '2010-01-01 00:00:00',
						'update_user_id' => 1,
			  )
	 );
	 $this->assertTrue($newProject->save(false));				  
}
}

 

Do you know what the problem is here?

Link to post
Share on other sites

No, I'm not using any frameworks. And I mostly code in the procedural style and hardly ever do any OOP. Right now I'm working with JSP pages, which is new to me. I wish there were better documentation for JSP. I've been kind of spoiled by PHP's documentation. And of course, Larry hasn't written a book on JSP to de-mystify it!

Link to post
Share on other sites

I think everyone would love to see you write a book on a fully developed website using oop code. There are also only two Yii Framework books available right now, I'm sure if you did one it would be a big hit. Even making a full working site using oop code intergrating into Yii. :rolleyes:

Link to post
Share on other sites

Well, my PHP 5 Advanced book discusses OOP, and when I write the 3rd edition (starting next month), I'll expand that coverage.

 

I wouldn't expect that my Yii book would teach OOP, but I imagine I'd have a chapter introducing the core concepts of OOP. You can actually use Yii without much OOP training because the hardest part--designing classes--is done by the framework.

Link to post
Share on other sites

It's okay what you've got is fine, there is enough OOP in PHP 5 Advanced for us to be able to work the rest out ourselves. Learning Yii also drastically helps us improve our knowledge and understanding on the implementations of OOP. Hope you enjoyed your weekend, happy to be back here for more posts.

Link to post
Share on other sites
  • 1 month later...

I'm sorry but i'm not writing to help you with your questions, however i wanna know how the hell did you make phpunit work, i've spent like 4 days trying to do so but i coundnt, i've this link on stack over flow as i posted a question thier, you can get the details if you decided to help, link: http://stackoverflow.com/questions/10034966/i-want-to-link-xampp-1-7-7-to-the-php-cli, the title of the question sounds different from what i'm asking but that how it started,

thank you for reading this,

Mohamad

Link to post
Share on other sites

I went through a lot of online help which ended up not working, so i decided to call it quits and just completely reinstall a new version of XAMMP. After the installation phpunit worked out fine. I thought with that Jeffrey Winesett book that some of the phpunit testing was quite trival, and the application could of just been tested the usual way we do by simple debugging, so be quite honest phpunit seemed a little over the top. Much of the debugging work comes is all about a good level of common sense.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...