Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ phpcs.xml export-ignore
phpunit.xml.dist export-ignore
README.md export-ignore
tests/ export-ignore
structarmed.php export-ignore
19 changes: 19 additions & 0 deletions .github/workflows/structarmed.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: StructArmed

on: [push, pull_request]

jobs:
test:
name: Run StructArmed static analysis with PHP v8.4
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup PHP 8.4
uses: shivammathur/setup-php@v2
with:
php-version: "8.4"
- uses: php-actions/composer@v6
- name: Include StructArmed
run: composer require --dev boundwize/structarmed:^0.10
- name: Run StructArmed
run: vendor/bin/structarmed analyze
9 changes: 9 additions & 0 deletions structarmed.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

declare(strict_types=1);

use Boundwize\StructArmed\Architecture;
use Boundwize\StructArmed\Preset\Preset;

return Architecture::define()
->withPreset(Preset::PSR4());
2 changes: 1 addition & 1 deletion tests/Feature/AliasesTest.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Feature;
namespace Tests\Feature;

use Tests\TestCase;
use Typesense\Exceptions\ObjectNotFound;
Expand Down
6 changes: 3 additions & 3 deletions tests/Feature/AnalyticsEventsTest.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Feature;
namespace Tests\Feature;

use Tests\TestCase;
use Exception;
Expand Down Expand Up @@ -127,7 +127,7 @@ public function testCanRetrieveEventsWithAPI(): void
"user_id" => "test_user"
]
];

$this->client()->analytics->events()->create($event);

$response = $this->client()->analytics->events()->retrieve([
Expand Down Expand Up @@ -165,4 +165,4 @@ public function testCanCreateEventWithDifferentEventTypes(): void
$conversionResponse = $this->client()->analytics->events()->create($conversionEvent);
$this->assertIsArray($conversionResponse);
}
}
}
8 changes: 4 additions & 4 deletions tests/Feature/AnalyticsEventsV1Test.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Feature;
namespace Tests\Feature;

use Tests\TestCase;
use Exception;
Expand All @@ -12,11 +12,11 @@ class AnalyticsEventsV1Test extends TestCase
protected function setUp(): void
{
parent::setUp();

if ($this->isV30OrAbove()) {
$this->markTestSkipped('Analytics is deprecated in Typesense v30+');
}

$this->client()->collections->create([
"name" => "products",
"fields" => [
Expand Down Expand Up @@ -58,7 +58,7 @@ protected function setUp(): void
protected function tearDown(): void
{
parent::tearDown();

if (!$this->isV30OrAbove()) {
try {
$this->client()->analyticsV1->rules()->{'product_queries_aggregation'}->delete();
Expand Down
12 changes: 6 additions & 6 deletions tests/Feature/AnalyticsRulesTest.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Feature;
namespace Tests\Feature;

use Tests\TestCase;
use Typesense\Exceptions\RequestMalformed;
Expand Down Expand Up @@ -105,10 +105,10 @@ public function testCanCreateRulesWithAPI(): void

$response = $this->client()->analytics->rules()->create($rules);
$this->assertIsArray($response);

$allRules = $this->client()->analytics->rules()->retrieve();
$this->assertIsArray($allRules);

$ruleNames = array_column($allRules, 'name');
$this->assertContains('test_rule_1', $ruleNames);
$this->assertContains('test_rule_2', $ruleNames);
Expand Down Expand Up @@ -161,10 +161,10 @@ public function testArrayAccessCompatibility(): void
{
$rule = $this->client()->analytics->rules()[$this->ruleName];
$this->assertInstanceOf('Typesense\AnalyticsRule', $rule);

$this->assertTrue(isset($this->client()->analytics->rules()[$this->ruleName]));

$rule = $this->client()->analytics->rules()[$this->ruleName];
$this->assertInstanceOf('Typesense\AnalyticsRule', $rule);
}
}
}
2 changes: 1 addition & 1 deletion tests/Feature/AnalyticsRulesV1Test.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Feature;
namespace Tests\Feature;

use Tests\TestCase;
use Typesense\Exceptions\ObjectNotFound;
Expand Down
Loading