<?xml-stylesheet type="text/xsl" href="https://sugarclub.sugarcrm.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Writing PHPUnit tests just got easier!</title><link>/dev-club/b/dev-blog/posts/writing-phpunit-tests-just-got-easier</link><description>We can probably all agree that automated tests are great, but sometimes we put off writing them because the initial first step of getting everything working correctly can be really difficult. 
Good news, Sugar developers! Writin...</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Writing PHPUnit tests just got easier!</title><link>https://sugarclub.sugarcrm.com/dev-club/b/dev-blog/posts/writing-phpunit-tests-just-got-easier</link><pubDate>Fri, 21 Jul 2023 07:03:06 GMT</pubDate><guid isPermaLink="false">5c521d64-519d-47a6-9065-134618b211bf:0877fb3d-198b-4e3c-8009-0fa3c018bcbd</guid><dc:creator>David Inglis</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;Hello Matt,&amp;nbsp; I am trying to write unit-php tests for Sugar 12.0.&amp;nbsp; The goal is to write these using Mocks of everything without the database.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;In one of our Logic Hooks that I am trying to test, we call the method BeanFactory::getBean(&amp;#39;Accounts&amp;#39;, $accountId);.&amp;nbsp; This then invokes AccessControlManager which tries to load data from the database.&amp;nbsp; Is it possible to either mock completely the BeanFactory to override getBean() OR override the&amp;nbsp;&lt;span&gt;AccessControlManager invocation?&lt;/span&gt;&lt;/p&gt;&lt;img src="https://sugarclub.sugarcrm.com/aggbug?PostID=899&amp;AppID=56&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: Writing PHPUnit tests just got easier!</title><link>https://sugarclub.sugarcrm.com/dev-club/b/dev-blog/posts/writing-phpunit-tests-just-got-easier</link><pubDate>Wed, 19 Feb 2020 06:55:12 GMT</pubDate><guid isPermaLink="false">5c521d64-519d-47a6-9065-134618b211bf:0877fb3d-198b-4e3c-8009-0fa3c018bcbd</guid><dc:creator>Sino Thomas</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;Hello Matt,&lt;/p&gt;
&lt;p&gt;I am trying to set the PHPunit test suite with Sugarcrm 8.0.1 Enterprise version.I downloaded the branch 8_0_0 from this&amp;nbsp;&lt;a href="https://github.com/sugarcrm/unit-tests/" rel="nofollow noopener noreferrer" target="_blank"&gt;https://github.com/sugarcrm/unit-tests/&lt;/a&gt;&amp;nbsp;.&lt;/p&gt;
&lt;p&gt;When I&amp;nbsp; trying to setup using the following steps&lt;/p&gt;
&lt;pre&gt;&amp;nbsp;{SugarClub Administrator Edit: We&amp;#39;re sorry, but this image is no longer available} &amp;nbsp;&lt;/pre&gt;
&lt;p&gt;Composer Install is not completed I faced some issue with downloading and after that I tried to run the following&lt;/p&gt;
&lt;blockquote class="jive_macro_quote jive-quote jive_text_macro"&gt;
&lt;p&gt;..\..\vendor\phpunit\vendor\bin\phpunit --testsuite custom&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;it showing this error message&amp;nbsp; &amp;nbsp;&amp;#39;Class &amp;quot;Sugarcrm\SugarcrmTestsUnit\AnnotationListener&amp;quot; does not exist&amp;#39;.&lt;/p&gt;
&lt;p&gt;Please help to solve this issues.&lt;/p&gt;&lt;img src="https://sugarclub.sugarcrm.com/aggbug?PostID=899&amp;AppID=56&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: Writing PHPUnit tests just got easier!</title><link>https://sugarclub.sugarcrm.com/dev-club/b/dev-blog/posts/writing-phpunit-tests-just-got-easier</link><pubDate>Mon, 17 Feb 2020 16:10:24 GMT</pubDate><guid isPermaLink="false">5c521d64-519d-47a6-9065-134618b211bf:0877fb3d-198b-4e3c-8009-0fa3c018bcbd</guid><dc:creator>Andrii  Litvinov</dc:creator><slash:comments>1</slash:comments><description>
&lt;p&gt;Hello, Matt! I have investigated Professor M&amp;#39;s tests and the way they are working with mock data. It is interesting but ...&lt;/p&gt;&lt;p&gt;I want to do tests on real Sugar Beans and not on mockup objects. Can you please give some tips about how to do this?&amp;nbsp;&lt;br /&gt;My scenario is :&lt;/p&gt;&lt;p&gt;In setUp&lt;/p&gt;&lt;p&gt;1) Create Contact&lt;/p&gt;&lt;p&gt;2) Create Prospect List&lt;/p&gt;&lt;p&gt;3) Relate Contact to Prospect List&lt;/p&gt;&lt;p&gt;4) In Assertion section check the result of of hooks &amp;quot;after_relationship_add&amp;quot; and &amp;quot;after_save&amp;quot;&lt;/p&gt;&lt;p&gt;Thanks in advance.&lt;/p&gt;
&lt;img src="https://sugarclub.sugarcrm.com/aggbug?PostID=899&amp;AppID=56&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: Writing PHPUnit tests just got easier!</title><link>https://sugarclub.sugarcrm.com/dev-club/b/dev-blog/posts/writing-phpunit-tests-just-got-easier</link><pubDate>Fri, 07 Feb 2020 09:57:04 GMT</pubDate><guid isPermaLink="false">5c521d64-519d-47a6-9065-134618b211bf:0877fb3d-198b-4e3c-8009-0fa3c018bcbd</guid><dc:creator>Sino Thomas</dc:creator><slash:comments>0</slash:comments><description>
&lt;p&gt;When I trying to download the unit test suite I got 404 page error from this link&amp;nbsp;&lt;a href="https://github.com/sugarcrm/unit-tests" rel="nofollow" target="_blank"&gt;https://github.com/sugarcrm/unit-tests&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;img src="https://sugarclub.sugarcrm.com/aggbug?PostID=899&amp;AppID=56&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item></channel></rss>