-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: company test and project filter by company.
- Loading branch information
Showing
9 changed files
with
128 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
namespace TeamWorkPm\Tests; | ||
|
||
use TeamWorkPm\Company; | ||
|
||
class CompanyTest extends TestCase | ||
{ | ||
public function testResolvePath(): void | ||
{ | ||
$this->assertEquals('companies', Company::resolvePath()); | ||
} | ||
|
||
public function testAll(): void | ||
{ | ||
$companies = Company::all(); | ||
$this->assertCount(1, $companies); | ||
} | ||
|
||
public function testGet(): void | ||
{ | ||
$company = Company::get(1370007); | ||
$this->assertEquals(1370007, $company->id); | ||
$this->assertEquals("Php's Company", $company->name); | ||
$this->assertEquals('1370007-php-s-company', $company->companyNameUrl); | ||
$this->assertEquals('1370007-php-s-company', $company['company_name_url']); | ||
$this->assertTrue($company->canSeePrivate); | ||
$this->assertTrue($company['can_see_private']); | ||
$this->assertEquals('2023-11-29T11:54:33Z', $company->createdOn); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
namespace TeamWorkPm\Tests\Handlers; | ||
|
||
use Psr\Http\Message\RequestInterface; | ||
use Psr\Http\Message\ResponseInterface; | ||
use Illuminate\Api\Testing\Handlers\ResponseHandler; | ||
|
||
class GetCompaniesByProjectHandler | ||
{ | ||
public static function requestHandle(RequestInterface $request, array &$options) | ||
{ | ||
return 200; | ||
} | ||
|
||
public static function responseHandle(ResponseInterface $response) | ||
{ | ||
$handler = new ResponseHandler($response); | ||
|
||
$companies = file_get_contents(__DIR__ . '/../schemas/get.companies.json'); | ||
|
||
$companies = json_decode($companies); | ||
|
||
$handler->setBody($companies); | ||
|
||
return $handler->getResponse(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
[ | ||
{ | ||
"zip": "", | ||
"contacts": "0", | ||
"last-changed-on": "", | ||
"phone": "", | ||
"state": "", | ||
"created-on": "2023-11-29T11:54:33Z", | ||
"industryId": "", | ||
"email_one": "", | ||
"company_name_url": "1370007-php-s-company", | ||
"address_two": "", | ||
"logo-URL": "", | ||
"country": "", | ||
"address_one": "", | ||
"id": "1370007", | ||
"can_see_private": true, | ||
"cid": "", | ||
"isowner": "1", | ||
"industry": "", | ||
"accounts": "1", | ||
"email_two": "", | ||
"name": "Php's Company", | ||
"email_three": "", | ||
"city": "", | ||
"countrycode": "", | ||
"fax": "", | ||
"website": "", | ||
"tags": [], | ||
"clients": "0", | ||
"collaborators": "0" | ||
} | ||
] |