In a previous post, we learned how to write JavaScript unit tests using Sugar 7’s Jasmine framework.  Today we will learn how to write PHP unit tests using Sugar 7’s PHPUnit framework.  If you do not have access to Sugar 7 unit-tests Github repository and you are a current SugarCRM customer or partner then you should request access.

This post will assume that you are already familiar with PHPUnit fundamentals.  If not, you can check out their Getting Started Guide.

Even if you do not have access or choose not to use the Sugar 7 PHPUnit framework, readers should still find the concepts covered in this post useful for testing Sugar 7 code.

Testing a Logic Hook

We will start with a realistic code customization so we can create a useful example of some unit tests.  There are a variety of server-side code customizations that are possible within Sugar 7 but perhaps the most common example would be the Logic Hook.  If you’ve done any significant amount of development on Sugar then you’ve like likely written more than one logic hook.  Sugar logic hooks have been an important tool in the Sugar Developer’s toolbox since well before the release of Sugar 7.  So this is a very appropriate example for us to use.

Continue Reading…

In this post by Jelle Vink, SugarCRM’s Security Architect and resident Elasticsearch expert, offers an explanation of how the Sugar Job Scheduler and Job Queue affects Sugar 7’s record indexing behavior.

Cron.php Execution

When cron.php is executed, there is a limit of how many jobs the driver executes and how long it will run. When either maximum is reached, the current cycle will terminate. The default maximums are 25 jobs and 1,800 seconds. Both can be changed in config_override.php:

$sugar_config['cron']['max_cron_jobs'] = 25;
$sugar_config['cron']['max_cron_runtime'] = 1800;

There is also a minimum interval in minutes (which defaults to 1). If cron is executed multiple times in a row, it will only actually do something when the minimum interval is met. This can be changed to allow another cycle to be run again immediately after the previous finishes by using the following setting.

 $sugar_config['cron']['min_cron_interval'] = 0;
Sugar Job Framework

Sugar Job Framework

Elasticsearch Job Creation

Continue Reading…

This tutorial will cover the creation of new Jasmine unit tests for testing your Sugar 7 front end code.

In order to follow this tutorial, you will need access to the Sugar 7 Unit Test repository.  Make sure you have the latest code.  If you do not have access, then request access here.  You must be a current SugarCRM Customer or Partner.

The key concepts for testing your Sugar 7 JavaScript code will be the same no matter the framework in use.

Testing a Dashlet

In order for this to be a realistic example, we need to identify a Sidecar component that we want to test.  You could write your test against any part of the Sugar application including the out of the box Sugar 7 Sidecar components but lets take a moderately complex dashlet that we introduced in a previous blog post called Creating a Dashlet for Sugar 7 List Views.

Continue Reading…

Here is a guest post from a couple members of the Sugar Developer community.  Yann Berges and Cédric Mourizard from Synolia, an Elite SugarCRM Partner, share some insights on how to improve the quality of Elasticsearch results in Sugar.

Elasticsearch in Sugar 7

Since Sugar 6.5, Elasticsearch has been included as a core feature of the Sugar Application and became a required component in Sugar 7.x releases. You can find some information regarding installation, configuration, and monitoring of Elasticsearch in the Knowledge Base.

It works very well and is pretty fast!

However, the default configuration is often too strict with diacritics such as accent and stressed letters found in languages like French.  For example, the default configuration will not match e with é during a global search which is not desirable for us.

Search for

Search for “Saute” did not match “Sautéed”

Below we will explore how Elasticsearch Analyzers can be used to address this issue.  It is quite easy and does not require custom code!

Continue Reading…

Have you checked out the Current Opportunities at SugarCRM lately?  We’re hiring heavily today across all sorts of technical roles at Sugar – including an open position to work with me as a Developer Advocate for SugarCRM!

What does a Sugar Developer Advocate do?

In the past, the term the industry tended to use was “Developer Evangelist” – which frankly always sounded a bit fishy to me.  For me, I much preferred the term “Developer Advocate” which is now much more common in the Software industry.  An Evangelist sounds like someone who is more style than substance.  An Advocate is someone who should listen as much as they talk.

This means that Sugar Developer Advocate act as ambassadors to the Sugar Developer community as well as being a critical stakeholder within SugarCRM Engineering that represents the wants and needs of Sugar Developer community and the Sugar 7 platform.  I think this is a great position for anybody with some good software development experience who is energetic, has good communication skills, has a positive attitude, and loves working with developers!

Check out the posting for more details!

A long established tradition within Engineering here at SugarCRM is something that we call “Hack Week”.  A couple times a year we fly our engineers from all over the world to our headquarters in Cupertino, CA for a week of fun, creativity, and some serious hacking.  On the week of July 27th 2015, it happened again!

Continue Reading…

Do you write unit tests for your Sugar customizations?

Do you performance test your Sugar on-site deployments?

Every developer knows they should be building unit tests and performance tests but sometimes it is just too hard to get started from nothing.  Well now SugarCRM Engineering is going to make it easy for you!

The Sugar 7 unit test suite and performance test frameworks that we use to develop Sugar 7 are now available to current customers and partners via Github!

This is the first release in a new effort to provide enhanced standardized development tooling and automation to the Sugar Developer community.

At this time, we are only releasing these tools to existing Sugar Customers and Sugar Partners.  So these private Github repositories require that you are logged in using your Github account in order to access them.  You may also need to request access from SugarCRM if you cannot access these repositories currently.

In the coming weeks, we will be posting step-by-step tutorials for creating Sugar 7 unit tests and custom JMeter scenarios. So stay tuned!

More details below.

Continue Reading…