<?xml version="1.0"?>
<rss version="2.0">
  <channel>
    <title>PHPDeveloper.org</title>
    <link>http://www.phpdeveloper.org</link>
    <description>Up-to-the Minute PHP News, views and community</description>
    <language>en-us</language>
    <pubDate>Sat, 18 May 2013 16:55:24 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[Gonzalo Ayuso's Blog: Strange behavior in PHP with method visibility]]></title>
      <guid>http://www.phpdeveloper.org/news/18012</guid>
      <link>http://www.phpdeveloper.org/news/18012</link>
      <description><![CDATA[<p>
In his <a href="http://gonzalo123.wordpress.com/2012/05/28/strange-behaviour-in-php-with-method-visibility/">recent post</a> <i>Gonzalo Ayuso</i> shares some "strange behavior" he found with method visibility in his recent development:
</p>
<blockquote>
Normally I feel very comfortable with PHP, but not all is good. There's some things I don't like. One is the lack of real annotations and another one is this rare behaviour with visibility within the OO. Let me explain this a little bit.
</blockquote>
<p>
The problem came up as a part of a recent refactor where a protected method, when called from an object injected into another class, threw an "access" error that it was called from the wrong context. He <a href="https://bugs.php.net/bug.php?id=62045">reported it as a bug</a> but was reminded of how PHP handles exposure - on the class level, not the instance of a class level.
</p>
]]></description>
      <pubDate>Mon, 28 May 2012 18:09:08 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Volker Dusch's Blog: The UNIT in unit testing]]></title>
      <guid>http://www.phpdeveloper.org/news/17677</guid>
      <link>http://www.phpdeveloper.org/news/17677</link>
      <description><![CDATA[<p>
<i>Volker Dusch</i> has <a href="http://edorian.posterous.com/the-unit-in-unit-testing">a new post</a> reminding us about what the "unit" part of "unit testing" means - small chunks of testable parts in an application.
</p>
<blockquote>
What does the word UNIT in unit testing stand for? Think of an answer and read on! So? Did you say "A method! Because we test methods!"? If so let me offer another perspective.
</blockquote>
<p>
He suggests that, rather than about just the methods in the class, it's more about testing the "observable behaviors" of the class. That is, anything that you could publicly use the class for and have something happen. He gives examples of this shift in focus - calling setValue and evaluating the result versus just calling the class property itself (then calling the method). He also includes a bit about testing behaviors - what happens when my script does [this] and how does that effect the overall class.
</p>
<blockquote>
When your tests fail but the class "still works" and you need to "fix the tests" the your tests are worth a lot less as they don't really give you that cozy safety net that they should provide you with.
</blockquote>]]></description>
      <pubDate>Thu, 15 Mar 2012 08:24:03 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[User Group: Boston PHP Welcomes Chris Shiflett]]></title>
      <guid>http://www.phpdeveloper.org/news/17544</guid>
      <link>http://www.phpdeveloper.org/news/17544</link>
      <description><![CDATA[<p>
The Boston PHP User Group will be having their next meeting <a href="http://www.meetup.com/bostonphp/events/30179741/">tonight (the 15th) at 7pm</a> at the Microsoft N.E.R.D Center in Cambridge. The featured speaker for the evening is <a href="http://shiflett.org">Chris Shiflett</a>, a well-known member of the PHP community. He'll be speaking on "Security-Centered Design: Exploring the Impact of Human Behavior".
</p>
<blockquote>
Join Boston PHP and O'Reilly Author Chris Shiflett as we take you through a fascinating talk on the human behavior and social aspect of security. We'll explore topics such as change blindness and ambient signifiers, and we'll show some real-world examples that demonstrate the profound impact human behavior can have on security. If your a designer, developer, human interaction designer, you won't want to miss this talk.
</blockquote>
<p>
So far there's <a href="http://www.meetup.com/bostonphp/events/30179741/">over 150 marked as attending</a> - if you plan on trying to make it tonight, be sure you RSVP so they know how many to expect.
</p>]]></description>
      <pubDate>Wed, 15 Feb 2012 07:11:37 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[PHPMaster.com: Under the Hood of Yii's Component Architecture, Part 3]]></title>
      <guid>http://www.phpdeveloper.org/news/17537</guid>
      <link>http://www.phpdeveloper.org/news/17537</link>
      <description><![CDATA[<p>
PHPMaster.com is back with the <a href="http://phpmaster.com/under-the-hood-of-yii%E2%80%99s-component-architecture-part-3/">third part of their series</a> looking at the internals of the Yii framework (specifically, its components). In this latest article <i>Steven O'Brien</i> focuses on how the framework uses behaviors.
</p>
<blockquote>
A behavior, as it is called in Yii, is a manner of combining objects at runtime to extend an object's functionality. Behaviors are an excellent way to decouple code and keep ever expanding systems maintainable. [...] We can not reuse our code effectively because PHP doesn't support multiple inheritance. The Yii behavior system is a way of achieving multiple inheritance by implementing <a href="http://en.wikipedia.org/wiki/Mixin">mixins</a>.
</blockquote>
<p>
He gives an example of working with a user that's connecting to your application just to get to a third-party billing system. They show how to take this functionality our of your generic "User" class and make a behavior out of it. This functionality can then be attached to the User object (via an attachBehavior call) and used directly. He gets into how Yii does this magic, showing how it appends it to a special value in the class and the __call method checks the method call to see if it exists in one of these special classes.
</p>]]></description>
      <pubDate>Tue, 14 Feb 2012 09:28:34 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Michael Kimsal's Blog: magic __get and __set style?]]></title>
      <guid>http://www.phpdeveloper.org/news/15608</guid>
      <link>http://www.phpdeveloper.org/news/15608</link>
      <description><![CDATA[<p>
In <a href="http://michaelkimsal.com/blog/magic-__get-and-__set-style/">this recent post</a> to his blog <i>Michael Kimsal</i> asked about the usefulness of the __get and __set magic methods and the sort of code he usually sees along with it.
</p>
<blockquote>
For a long time I've held that __get and __set in PHP were not all that hot  - mostly because it's solely error handling.  There's no way to deal invoke __get or __set behaviour for properties that are defined on a class. [...] For those who insist on using __get/__set, I *typically* see this [messyy] sort of style code. The effect is to cram a bunch of unrelated code in to the __get/__set overloading methods.
</blockquote>
<p>
He suggests an alternative to the "cram it all in __get" approach - callbacks to other methods in the class to handle the different variable possibilities. In the comments there's other suggestions on how to get the same job done differently - mapping property values with __call, valid uses for getters/setters and a pointer to <a href="http://wiki.php.net/rfc/propertygetsetsyntax">an internals discussion RFC</a> about this same thing. 
</p>]]></description>
      <pubDate>Tue, 21 Dec 2010 09:36:05 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[ServerGrove Blog: Interesting symfony plugins: sfBehatPlugin]]></title>
      <guid>http://www.phpdeveloper.org/news/15160</guid>
      <link>http://www.phpdeveloper.org/news/15160</link>
      <description><![CDATA[<p>
On the ServerGrove blog there's <a href="http://blog.servergrove.com/2010/09/20/interesting-symfony-plugins-sfbehatplugin/">a new post</a> spotlighting one of the Symfony plugins they think is interesting - the <a href="http://www.symfony-project.org/plugins/sfBehatPlugin">sfBehatPlugin</a>, an interface into the <a href="http://everzet.com/Behat/">Behat</a> system for behavior-driven development.
</p>
<blockquote>
Quality assurance (QA) is one of the most difficult things to implement around software development. Most of time it is left for the final phase of development and very often overlooked entirely. As many experienced web development teams already know, QA needs to be part of the development process from the get-go. [...] Behavior development/testing is just one aspect of quality assurance. 
</blockquote>
<p>
They briefly touch on the installation of the plugin (Symfony plugins are usually pretty easy to get set up) and <a href="http://everzet.com/sfBehatPlugin/#install">link to the project's homepage</a> for more references on some of the basics of using it to act as a browser, parse the response and use forms on a page.
</p>]]></description>
      <pubDate>Tue, 21 Sep 2010 08:09:57 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[PHP in Action Blog: One behavior != one assertion]]></title>
      <guid>http://www.phpdeveloper.org/news/12011</guid>
      <link>http://www.phpdeveloper.org/news/12011</link>
      <description><![CDATA[<p>
On the PHP in Action blog, despite some agreement with <i>Padraic Brady</i> on his <a href="http://www.phpdeveloper.org/news/11958">one behavior, one assertion</a> method for writing unit tests, <i>Dagfinn Reiersol</i> still <a href="http://blog.agilephp.com/2009/02/21/one-behavior-one-assertion/">has his reservations</a>.
</p>
<blockquote>
Pádraic maintains that one assertion per test is a rule that should always be followed unless there is a specific good reason to break it. I prefer it as a guideline, as does Robert C. Martin in the book <a href="http://www.amazon.com/gp/product/0132350882?ie=UTF8&tag=phinac-20&linkCode=as2&camp=1789&creative=9325&creativeASIN=0132350882">Clean Code</a>. The reference is not intended as an appeal to authority to "prove" that I'm right. I'm just making the point that I think this reflects the current state of the art, which is not necessarily perfect, of course.
</blockquote>
<p>
<i>Dagfinn</i> talks about behavior-driven development and illustrates how a two assertions could be combined into one but that the end result "isn't very pretty" - and that's just testing two proterties of a single object. Imagine what would happen if things got more complex.
</p>]]></description>
      <pubDate>Tue, 24 Feb 2009 11:13:17 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Debuggable Blog: More CakePHP Tips/Behaviors]]></title>
      <guid>http://www.phpdeveloper.org/news/10945</guid>
      <link>http://www.phpdeveloper.org/news/10945</link>
      <description><![CDATA[<p>
<i>Felix Geisendorfer</i> has posted a new more helpful hints to the Debuggable blog for the CakePHP developers out there. Here's the most recent:
</p>
<ul>
<li><a href="http://feeds.feedburner.com/~r/debuggable/~3/379675923/normalizing-cakephp-model-records:48b7ed7f-9498-4b9c-8734-6f014834cda3">Normalizing CakePHP model records</a>
<li><a href="http://feeds.feedburner.com/~r/debuggable/~3/379675922/lookupable-behavior:48b93b4a-eaf8-4fc8-85ad-6d454834cda3">Lookupable Behavior</a>
<li><a href="http://feeds.feedburner.com/~r/debuggable/~3/379675921/cloud-behavior:48ba9455-30c8-46de-9e24-4cd94834cda3">Cloud Behavior</a>
<li><a href="http://feeds.feedburner.com/~r/debuggable/~3/380452004/akismet-datasource:48bbe6f0-b7c0-47e5-8337-15624834cda3">Akismet Datasource</a>
</ul>
<p>
Check out their <a href="http://debuggable.com/categories/php-and-cakephp:480f4dd5-6fb0-4cb4-b3cb-4f1ccbdd56cb">PHP and CakePHP</a> category on the blog for more great articles and tips.
</p>]]></description>
      <pubDate>Tue, 02 Sep 2008 12:04:03 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Jonathan Snook's Blog: Multiple Validation as Behavior in CakePHP 1.2]]></title>
      <guid>http://www.phpdeveloper.org/news/10723</guid>
      <link>http://www.phpdeveloper.org/news/10723</link>
      <description><![CDATA[<p>
<i>Jonathan Snook</i> has <a href="http://snook.ca/archives/cakephp/multiple_validatable_behavior/">posted an update</a> to a <a href="http://www.phpdeveloper.org/news/10661">previous post</a> about validating multiple input fields at the same time in a CakePHP application. This update changes the way the validation is handled and moves it over into a Behavior.
</p>
<blockquote>
Using the new behavior is much like using the script as it was before. You can name the validation properties to include the action name and it'll automatically set that validation set as the default.
</blockquote>
<p>
His behavior lets you define validation rules, both included in a default set and as callbacks. He includes an example of its use and the full code (all thirty lines of it) for the behavior itself.
</p>]]></description>
      <pubDate>Thu, 31 Jul 2008 08:44:30 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Blog.szajbe.pl:  Not so obvious behavior of $uses in CakePHP]]></title>
      <guid>http://www.phpdeveloper.org/news/10570</guid>
      <link>http://www.phpdeveloper.org/news/10570</link>
      <description><![CDATA[<p>
In <a href="http://blog.szajbe.pl/2008/07/07/not-so-obvious-behavior-of-uses-in-cakephp/">this new post</a> to the blog.szajbe.pl site a dilemma is presented - CakePHP models are not working they way one would think they should.
</p>
<blockquote>
In CakePHP you declare what models you're going to use in a controller by defining $uses variable. You can also define it in AppController to have a certain set of models available in every controller. However be careful when doing it because you may put yourself in an unexpected situation as I did recently.
</blockquote>
<p>
As soon as he made his script include a 'User' model in every quest, his logins stopped working. His script errored with a "Database table sessions for model Session was not found" message and refused to work. Digging deeper, he found that CakePHP merges an AppController's $uses value with the SessionControler's values. One overrides the other and your 'User' gets lost in the shuffle.
</p>
<blockquote>
Do you have a rational explanation for such behavior? I have none. It's very unintuitive for me.
</blockquote>]]></description>
      <pubDate>Wed, 09 Jul 2008 12:02:41 -0500</pubDate>
    </item>
  </channel>
</rss>
