<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Gbeila Aliu Wahab on Medium]]></title>
        <description><![CDATA[Stories by Gbeila Aliu Wahab on Medium]]></description>
        <link>https://medium.com/@aliuwahab?source=rss-1d15028fa4ad------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*gbPtwxUuvzyY6CMqXJzXCg.png</url>
            <title>Stories by Gbeila Aliu Wahab on Medium</title>
            <link>https://medium.com/@aliuwahab?source=rss-1d15028fa4ad------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 09:20:37 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@aliuwahab/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Your Lock Is Not the Problem. The Intruder Changed.]]></title>
            <link>https://medium.com/@aliuwahab/your-lock-is-not-the-problem-the-intruder-changed-f4aa3e9e0bb1?source=rss-1d15028fa4ad------2</link>
            <guid isPermaLink="false">https://medium.com/p/f4aa3e9e0bb1</guid>
            <dc:creator><![CDATA[Gbeila Aliu Wahab]]></dc:creator>
            <pubDate>Thu, 22 Oct 2026 15:58:25 GMT</pubDate>
            <atom:updated>2026-10-22T15:58:25.578Z</atom:updated>
            <content:encoded><![CDATA[<p>Why the recent PHP security breach says more about the times than about the language. Every time a serious breach hits a popular technology, the same voices show up. <strong>“See, that tech is bad.”</strong> I have heard it about PHP for years, and now that a major security issue has made the rounds, they are back. I want to slow down and think about this properly, because the real question is not about PHP. It is about how the attackers have changed.</p><p><em>Let me use a simple picture.</em></p><p>Imagine you build a house with one door lock. For a long time, that lock was enough. The people who wanted to break in carried sticks. To get through an iron door, they needed effort, trial, and time, and most of them gave up.</p><p>Then this breach surfaced, a flaw that had reportedly sat in the codebase for about a decade without anyone noticing. The lock looked solid for years, and nobody knew it had a weakness. For the threat that existed, one lock was enough. For the threat that exists now, you cannot assume your lock has been holding all along. Now imagine someone with real money. He installs ten iron doors. Good. But the people trying to get in now have grenades and bulldozers. So tell me, in these two scenarios, who is at the highest risk? It is the man with ten doors. His defense was designed for a world of sticks. Counting doors does not help when the attacker stops knocking and starts demolishing walls. That is the honest picture of security today. Bad actors have AI: have grenades and bulldozers, and more: automated scanners, leaked credentials, faster exploit development, and supply chain attacks on packages we install without reading them. The cost of attacking has dropped and the reach has grown.</p><p>A breach in a widely used framework does not prove the framework is weak. It proves the attacker is strong, and that the target is worth the effort because so many people depend on it. That second point matters. When a language sits under a huge share of the web, every flaw gets found. Mature ecosystems get breached in public. That is not the same as decline. If anything, the attention tells you the language matters.</p><p><strong>So what do we do?</strong></p><p>I think it starts with a change in mindset. Build your apps assuming you will be breached. Not because you are careless, but because it is the right starting point. Once you accept that, the question changes. It stops being “how do I keep them out forever?” and becomes “if they get in, what is available to take?” <strong>That question leads to three habits.</strong> Store only what you must. Every field you do not need is a field that can leak. Do not keep data because it might be useful someday. Keep it because you need it today. Encrypt what is important. Encrypt sensitive values at rest, and manage the keys separately from the data they protect. Encryption does not make a system unbreachable. But done well, a thief who takes your database walks away with things he cannot read or use. He grabs what looks valuable and has no idea what to do with it. Limit what each part can reach. If one component is compromised, it should not hand over the whole system.</p><p>In a few years, I promise you, even name fields will be encrypted as a normal habit. People will look back at plaintext customer tables the way we look at unlocked car doors from the 1990s. The lesson is not to fear PHP, Laravel, or any other tool that runs serious products. The lesson is to stop designing for the attacker you wish you had and start designing for the one you actually face. Ten iron doors will not stop a bulldozer. Less to protect, and less that makes sense to a thief, will.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f4aa3e9e0bb1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mock Testing in Laravel.]]></title>
            <link>https://medium.com/the-andela-way/mock-testing-in-laravel-4a2fe15885b8?source=rss-1d15028fa4ad------2</link>
            <guid isPermaLink="false">https://medium.com/p/4a2fe15885b8</guid>
            <category><![CDATA[php]]></category>
            <category><![CDATA[the-andela-way]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[laravel]]></category>
            <dc:creator><![CDATA[Gbeila Aliu Wahab]]></dc:creator>
            <pubDate>Fri, 05 Apr 2019 09:37:24 GMT</pubDate>
            <atom:updated>2019-04-05T09:37:24.275Z</atom:updated>
            <content:encoded><![CDATA[<h3>Mock Testing in Laravel</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ZTz2Z1Y3N71t4dQw" /><figcaption>Photo by <a href="https://unsplash.com/@pankajpatel?utm_source=medium&amp;utm_medium=referral">Pankaj Patel</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><blockquote>One of Laravel’s gift to developers is to offer you in their opinions what they think you will need as a developer (some say they are opinionated) but for me after years of using it, I can only say, the Team knows what developers need (because they have done it over and over again) and provide the tools for us to succeed. One of such beautiful things the framework offers is a comprehensive pre-configured testing layer (extending PHPUnit).</blockquote><p>They didn’t stop there, they added a mocking layer for certain processes and objects, this helps developers in writing test cases to “<a href="https://laravel.com/docs/5.7/mocking">mock</a>” certain aspects of your application so they are not actually executed during a given test”.</p><p>E.g, when testing a controller activity that fires an email, or stores some file, or queues etc, you don’t need the application to actually send an email etc for you to write your test to pass, hence mocking.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/386/1*X77xu5zyG9fHD47q7pVqYA.png" /><figcaption>The outline for mocking in Laravel official docs.</figcaption></figure><p>In this short tutorial, we’re going to use the Laravel Bus Fake “Mocking” facade for testing to explain the concept of mocking in Laravel with TDD. A feature offered within Laravel that helps to carry a test on certain aspects of the application without necessarily triggering the action.</p><p>Assuming you have set up your PHPUnit configuration for your Laravel testing. If you haven’t, I suggest setting up a brand new Laravel app project and add this configuration to your PHPUnit (Note you can use any configuration of your choice).</p><pre>&lt;env name=”DB_CONNECTION” value=”sqlite”/&gt;</pre><pre>&lt;env name=”DB_DATABASE” value=”:memory:”/&gt;</pre><p>This sets the database type for testing to SQLite and the database to be “in memory”. I am going to use the Bus Fake class to explain the whole mocking in Laravel for writing test cases for certain functionality and that gives you a strong base to understand mocking emails, queues, notification etc using their respective fake classes. This process is similar, the difference is just the Fake classes and the assertions the offer.</p><p>We should do TDD, so let’s create our test first.</p><p>Testing by wishful thinking (learnt from Adam Wathan), you know something does not exist, but you write your test as if it is there, it will fail, you write the code to make it pass (TDD).</p><p>We create our test class i.e “ExampleTest” in the “Feature” directory within our “tests” folder.</p><p>The code of the ExampleTest is:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a66110f54a9941d6c9cac7fc11a74adf/href">https://medium.com/media/a66110f54a9941d6c9cac7fc11a74adf/href</a></iframe><p>Explanation of our test class.</p><p>We create only one test function call: bus_fake_test(). First disable the exception handling (so we can get any exception thrown without Laravel formatting it, when the test passes, I encourage you to take it off). Then the most important line:</p><pre>Bus::<em>fake</em>();</pre><p>Calling the Bus facade’s fake method. This provides us access to various assertions on the Bus class (we will talk more about that in a moment).</p><p>Of course, we leverage Laravels factory class to create a user.</p><pre>$user = factory(User::<strong>class</strong>)-&gt;create();</pre><p>We’re using the UserFactory class that Laravel at the time of this article automatically adds (see in the factories folder within the database folder).</p><p>Then we make a GET request to a URL:</p><pre>$this-&gt;get(&#39;/example/job&#39;);</pre><p>Next is the assertions:</p><pre>Bus::<em>assertDispatched</em>(ExampleJob::<strong>class</strong>, <strong>function </strong>($job) <strong>use </strong>($user) {<br>    <strong>return </strong>$job-&gt;user-&gt;id === $user-&gt;id;<br>});</pre><p>THIS IS WHY WE ARE HERE: The “Bus::<em>fake</em>();” provides us with relevant assertions that we can make on any Job class like the ExampleJob::<strong>class.</strong></p><p>The “<em>assertDispatched” assertion is to make sure the job was fired or dispatched.</em></p><p>In a moment, I will point you to all the various assertions you can make.</p><p>If you run this test,</p><pre>vendor/bin/phpunit --filter bus_fake_test</pre><p>Your PC will explode (kidding), it will fail. Let us make it pass.</p><p>First Failure:</p><pre>Symfony\Component\HttpKernel\Exception\NotFoundHttpException: GET <a href="http://localhost/example/job">http://localhost/example/job</a></pre><p>This squawking that there is no route example/job that we called in the test above. So head to your routes file, web.php and add a route closure: This route could have been linked to a controller but for simplicity, I will make it a closure.</p><pre>Route::<em>get</em>(&#39;/example/job&#39;, <strong>function </strong>() {</pre><pre>});</pre><p>If you run the test again, you will get:</p><pre>The expected [App\Jobs\ExampleJob] job was not dispatched.<br>Failed asserting that false is true.</pre><p>But don’t blame Laravel, you just returned a closure and you made an assertion that a certain ExampleJob::<strong>class </strong>has<strong> </strong>been<strong> </strong>dispatched<strong>.</strong></p><p>In fact, we don’t have a class like that. Let’s create the ExampleJob class with the line:</p><pre>“php artisan make:job ExampleJob”</pre><p>The content is:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c06bf30fc6c544572d962a5dc02d4a60/href">https://medium.com/media/c06bf30fc6c544572d962a5dc02d4a60/href</a></iframe><p>The Job class expects a User object in its constructor(it can be any data you wish to have access to within the job), then access the user object name to log it. It is within the handle method that you can carry out any action within a job, like sending an email, generating an invoice etc. depending on the data you pass to the constructor. You can do a lot with jobs, they are pretty powerful.</p><p>Here, in the handle method, we’re just logging the user name.</p><p>If we run our test, nothing will change from the previous error because the ExampleJob class has nothing to do with the route that we’re getting the response from to make our assertions. So let us do that.</p><pre>Route::<em>get</em>(&#39;/example/job&#39;, <strong>function </strong>() {<br>    $user = \App\User::<em>first</em>();<br>    \App\Jobs\ExampleJob::<em>dispatch</em>($user);<br>});</pre><p>Here, we’re getting the user and passing the user object into the ExampleJob class dispatch method, this is because we demanded for a user object in the ExampleJob constructor method.</p><p>NOTE: The job class has various methods like the dispatch and dispatchNow.</p><p>Now let us run our test, with any luck as Adam Wathan will say, it should be green (pass).</p><p>NOW:</p><p>Some of the assertions (as of now) on the</p><p>*Bus::fake();</p><p>include:</p><pre>assertDispatched($command, $callback = <strong>null</strong>)<br>assertDispatchedTimes($command, $times = 1)<br>assertNotDispatched($command, $callback = <strong>null</strong>)<br>dispatched($command, $callback = <strong>null</strong>)<br>hasDispatched($command)<br>dispatch($command)<br>dispatchNow($command, $handler = <strong>null</strong>) etc.</pre><p>You can use all the above to carry out assertions on your Laravel job classes without necessary firing the job.</p><p>NOTE:</p><p>As mentioned earlier, we also have Mocking for Event, Mail, Notification Queue, Storage etc.</p><p>So, for you to mock any of the mentioned objects, you just need to call the respective fake facade within the test method and use the respective assertions.</p><p><strong>Short Examples from the Laravel Docs:</strong></p><p>To mock Event, you need to pull in the event fake facade like:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c02e827536afb0dd2ef8001ae574aea5/href">https://medium.com/media/c02e827536afb0dd2ef8001ae574aea5/href</a></iframe><p>And you can call various assertions. To see the assertions for Event mocking just search for EventFake class with your editor and look within the class, you will see various assertions offered by the event class. In fact, for the various mocks just search for the respective mock (Event, Mail, Notification, Queue, and Storage){Mock}Fake and you will see the various assertions types available.</p><p>I hope you’ve learnt something about mocking in testing within Laravel. Keep Learning.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4a2fe15885b8" width="1" height="1" alt=""><hr><p><a href="https://medium.com/the-andela-way/mock-testing-in-laravel-4a2fe15885b8">Mock Testing in Laravel.</a> was originally published in <a href="https://medium.com/the-andela-way">The Andela Way</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Firestore(Firebase) PHP: Saving Data to a firestore database using php (Curl)]]></title>
            <link>https://medium.com/@aliuwahab/firestore-firebase-php-saving-data-to-a-firestore-database-using-php-curl-2921da3b0ed4?source=rss-1d15028fa4ad------2</link>
            <guid isPermaLink="false">https://medium.com/p/2921da3b0ed4</guid>
            <category><![CDATA[cloud-firestore]]></category>
            <category><![CDATA[api]]></category>
            <category><![CDATA[php]]></category>
            <category><![CDATA[google-firebase]]></category>
            <category><![CDATA[firestore]]></category>
            <dc:creator><![CDATA[Gbeila Aliu Wahab]]></dc:creator>
            <pubDate>Wed, 13 Jun 2018 15:54:43 GMT</pubDate>
            <atom:updated>2018-06-13T15:54:43.537Z</atom:updated>
            <content:encoded><![CDATA[<p>Firestore(Firebase) PHP: Saving Data to a firestore database using php (Curl)</p><p>Spent a lot of time searching to get a simple guide to do this but didn’t. The only resource available is the php client written by google at: <a href="https://github.com/GoogleCloudPlatform/google-cloud-php-firestore">https://github.com/GoogleCloudPlatform/google-cloud-php-firestore</a> I didn’t like it (But its good for real big needs) as I just needed to make a simple post from woocommerce to firestore. So I wrote this simple php curl request to accomplish. Just sharing, incase it helps you.</p><pre>$firestore_data  = [<br>        <strong>&quot;orderName&quot; </strong>=&gt; [<strong>&quot;stringValue&quot; </strong>=&gt; <strong>&quot;Gbeila Aliu Wahab&quot;</strong>],<br>        <strong>&quot;orderLocationName&quot; </strong>=&gt; [<strong>&quot;stringValue&quot; </strong>=&gt; <strong>&quot;Accra Mall Limited&quot;</strong>],<br>        <strong>&quot;orderTotalAmount&quot; </strong>=&gt; [<strong>&quot;doubleValue&quot; </strong>=&gt; 150.5],<br>        <strong>&quot;orderDescription&quot; </strong>=&gt; [<strong>&quot;stringValue&quot; </strong>=&gt; <strong>&quot;Lorem Ipsum is simply dummy text of the printing and typesetting industry&quot;</strong>],<br>        <strong>&quot;orderLocationGeoPoints&quot; </strong>=&gt; [<strong>&quot;geoPointValue&quot; </strong>=&gt; (object)[<strong>&quot;latitude&quot; </strong>=&gt; 5.5557, <strong>&quot;longitude&quot; </strong>=&gt; -0.1963]],<br>        <strong>&quot;orderStatus&quot; </strong>=&gt; [<strong>&quot;stringValue&quot; </strong>=&gt; <strong>&quot;NotAssigned&quot;</strong>],<br>    ];</pre><pre>    $data = [<strong>&quot;fields&quot; </strong>=&gt; (object)$firestore_data];<br><br><em>//    Possible *value options are:<br>//    stringValue<br>//    doubleValue<br>//    integerValue<br>//    booleanValue<br>//    arrayValue<br>//    bytesValue<br>//    geoPointValue<br>//    mapValue<br>//    nullValue<br>//    referenceValue<br>//    timestampValue<br><br>    </em>$json = <em>json_encode</em>($data);<br></pre><pre><em>$Enter your firestore unique key: below is a sample<br>    </em>$firestore_key = <strong>&quot;GAHAJDBGAKABGfWWJQWEORFBJAKAJHA&quot;</strong>;</pre><pre>#Provide your firestore project ID Here<br>    $project_id = <strong>&quot;dough-man-orders&quot;</strong>;<br><br>    $object_unique_id = random_int(1,300);<br><br>    $url = <strong>&quot;https://firestore.googleapis.com/v1beta1/projects/dough-man-orders/databases/(default)/documents/orders/&quot;</strong>.$object_unique_id;<br><br>    $curl = <em>curl_init</em>();<br><br>    <em>curl_setopt_array</em>($curl, <strong>array</strong>(<br>        <strong><em>CURLOPT_RETURNTRANSFER </em></strong>=&gt; <strong>true</strong>,<br>        <strong><em>CURLOPT_CUSTOMREQUEST </em></strong>=&gt; <strong>&#39;POST&#39;</strong>,<br>        <strong><em>CURLOPT_HTTPHEADER </em></strong>=&gt; <strong>array</strong>(<strong>&#39;Content-Type: application/json&#39;</strong>,<br>            <strong>&#39;Content-Length: &#39; </strong>. <em>strlen</em>($json),<br>            <strong>&#39;X-HTTP-Method-Override: PATCH&#39;</strong>),<br>        <strong><em>CURLOPT_URL </em></strong>=&gt; $url . <strong>&#39;?key=&#39;</strong>.$firestore_key,<br>        <strong><em>CURLOPT_USERAGENT </em></strong>=&gt; <strong>&#39;cURL&#39;</strong>,<br>        <strong><em>CURLOPT_POSTFIELDS </em></strong>=&gt; $json<br>    ));<br><br>    $response = <em>curl_exec</em>( $curl );<br><br>    <em>curl_close</em>( $curl );<br><br><em>// Show result<br>    </em><strong>echo </strong>$response . <strong>&quot;\n&quot;</strong>;</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2921da3b0ed4" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>