Updates from September, 2011 Toggle Comment Threads | Keyboard Shortcuts

  • danielsaidi 9:34 pm on September 15, 2011 Permalink | Reply
    Tags: pear, phpunit, ,   

    Getting PEAR and PHPUnit to work with MAMP 

    When I recently decided to start re-developing a PHP project of mine from scratch, I decided to replace SimpleTest with PHPUnit and PHPCover.

    To get familiar with PEAR, I found this great tutorial:

    http://akrabat.com/php/setting-up-php-mysql-on-os-x-10-7-lion/

    However, since I managed to screw up my PEAR configurations when playing around with it a month ago, the tutorial did not work.

    Turns out that PEAR was missing from where I wanted it to be installed, and that multiple PEAR installations were scattered all over the file system. The config file pointed to one of these locations, which made the installer believe that I had the latest release installed.

    Turns out that:

    Finally, I could follow the tutorial at the top of this post. Installing PHPUnit was a breeze after the invalid PEAR settings were fixed.

    You also need to grab PHPCover, which is described at https://github.com/sebastianbergmann/phpunit/

    Now, you have to set the include paths in /etc/php.ini. Mine looks like this:

    • include_path=”.:/php/includes:/usr/lib/php:/usr/lib/php/pear

    However, since I use MAMP, this is not the file that is to be. You need to modify the ini file in MAMP’s configuration area, and add the paths there as well.

    Now, PHPUnit will work, but I am yet to be convinced. SimpleTest seems easier to setup and flexible enough to cover all test cases I need, including mocking…plus that I can ship the testing framework with the development bundle.

    Any thoughts regarding this?

     
  • danielsaidi 3:06 pm on September 8, 2011 Permalink | Reply
    Tags: ,   

    TeamCity 6.5.1 does not play well with NServiceBus 

    I am currently moving projects from an old TeamCity 5.1.2 server to a new 6.5.1 server.

    Everything has been going great, until I tried moving a project that uses NServiceBus test framework. When TeamCity tries to launch these tests, it fails with the following error message (one of many):

    [xxx.Test_Name] Test(s) failed. System.InvalidOperationException : Could not load C:\TeamCity\BuildAgent3\work\c53933ba5b3b087f\xxx\bin\release\xxx.XmlSerializers.dll. Consider using ‘Configure.With(AllAssemblies.Except(“xxx.XmlSerializers.dll”))’ to tell NServiceBus not to load this file. —-> System.BadImageFormatException : Could not load file or assembly ‘file:///C:\TeamCity\BuildAgent3\work\c53933ba5b3b087f\xxx.Tests\bin\release\xxx.XmlSerializers.dll’ or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded. at NServiceBus.Configure.GetAssembliesInDirectoryWithExtension(String path, String extension, String[] assembliesToSkip) in d:\BuildAgent-02\work\672d81652eaca4e1\src\config\NServiceBus.Config\Configure.cs:line 213 at NServiceBus.Configure.<GetAssembliesInDirectory>d__3.MoveNext() in d:\BuildAgent-02\work\672d81652eaca4e1\src\config\NServiceBus.Config\Configure.cs:line 190 at System.Linq.Buffer`1..ctor(IEnumerable`1 source) at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source) at NServiceBus.Configure.With(String probeDirectory) in d:\BuildAgent-02\work\672d81652eaca4e1\src\config\NServiceBus.Config\Configure.cs:line 101 at NServiceBus.Configure.With() in d:\BuildAgent-02\work\672d81652eaca4e1\src\config\NServiceBus.Config\Configure.cs:line 75 at NServiceBus.Testing.Test.Initialize() in d:\BuildAgent-02\work\672d81652eaca4e1\src\testing\Test.cs:line 20 at xxx.Setup() in c:\TeamCity\BuildAgent3\work\c53933ba5b3b087f\xxx.Tests\xxxTests.cs:line 17 –BadImageFormatException at System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection) at System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection) at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) at System.Reflection.Assembly.InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, StackCrawlMark& stackMark) at System.Reflection.Assembly.LoadFrom(String assemblyFile) at NServiceBus.Configure.GetAssembliesInDirectoryWithExtension(String path, String extension, String[] assembliesToSkip) in d:\BuildAgent-02\work\672d81652eaca4e1\src\config\NServiceBus.Config\Configure.cs:line 204

    I have replaced secret component names with xxx – do not let it confuse you.

    Now, I am really wondering where d:\BuildAgent-02 comes from, since it does not exist on the old server and not on the new one either. After reading up a bit, it seems that it is an NServiceBus issue.

    The problem resambles the issue being described here:

    http://tech.groups.yahoo.com/group/nservicebus/message/6790

    However, I have installed VS2010 and SP1 and it still does not work. I am out of ideas. I have tried bending the laws of physics, but all I am left with is a NServiceBus test suite that just won’t work.

    Any ideas out there?

     
    • Eugene Petrenko 4:49 pm on September 8, 2011 Permalink | Reply

      Check you specified NUnit assemblies wildcard in the way **/obj/** folders are excluded. MSBuild used to put there assemblies without dependent assemblies.

c
Compose new post
j
Next post/Next comment
k
Previous post/Previous comment
r
Reply
e
Edit
o
Show/Hide comments
t
Go to top
l
Go to login
h
Show/Hide help
shift + esc
Cancel