public function testUserAdd() { $user = factory(User::class, 'valid-user')->make(); $values = ['first_name' => $user->first_name, 'last_name' => $user->last_name, 'email' => $user->email, 'username' => $user->username, 'password' => $user->password]; User::create($values); $this->tester->seeRecord('users', $values); }
public function testAssetAdd() { $company = factory(Company::class, 'company')->make(); $values = ['name' => $company->name]; Company::create($values); $this->tester->seeRecord('companies', $values); }
public function testAssetAdd() { $location = factory(Location::class, 'location')->make(); $values = ['name' => $location->name]; Location::create($values); $this->tester->seeRecord('locations', $values); }
public function testLostStatuslabelAdd() { $statuslabel = factory(Statuslabel::class, 'lost')->make(); $values = ['name' => $statuslabel->name]; Statuslabel::create($values); $this->tester->seeRecord('status_labels', $values); }
public function testLiking() { $idUser1 = 1; $idUser2 = 2; $idUser3 = 3; $idUser4 = 4; $photoidUser1 = 1; $photoidUser2 = 4; $photoidUser3 = 8; $photoidUser4 = 11; // User should be able to like photos they don't own list($result_code, $result) = User::likePhoto($idUser1, $photoidUser2); $this->assertEquals(200, $result_code); $this->assertTrue($result['success'] == true); $this->assertTrue($result['likes'] == true); $this->tester->seeInDatabase('UserPhotoLikes', ['userid' => $idUser1, 'photoid' => $photoidUser2]); // User should be able to unlike photos they don't own list($result_code, $result) = User::likePhoto($idUser1, $photoidUser2); $this->assertEquals(200, $result_code); $this->assertTrue($result['success'] == true); $this->assertTrue($result['likes'] == false); $this->tester->dontSeeInDatabase('UserPhotoLikes', ['userid' => $idUser1, 'photoid' => $photoidUser2]); // User should not be be able to like photos they own list($result_code, $result) = User::likePhoto($idUser1, $photoidUser1); $this->assertEquals(403, $result_code); $this->assertTrue($result['success'] == false); $this->tester->dontSeeInDatabase('UserPhotoLikes', ['userid' => $idUser1, 'photoid' => $photoidUser1]); // User should not be be able to like photos that don't exist list($result_code, $result) = User::likePhoto($idUser1, 0); $this->assertEquals(404, $result_code); $this->assertTrue($result['success'] == false); $this->tester->dontSeeInDatabase('UserPhotoLikes', ['userid' => $idUser1, 'photoid' => 0]); }
public function testRoleCanBeDeleted() { $id = $this->tester->haveRecord('roles', ['role_name' => 'user']); $role = \ChopBox\Role::find($id); $role->delete(); $this->tester->dontSeeRecord('roles', ['role_name' => 'user']); }
public function testConsumableAdd() { $consumable = factory(Consumable::class, 'consumable')->make(); $values = ['name' => $consumable->name, 'qty' => $consumable->qty, 'category_id' => $consumable->category_id, 'company_id' => $consumable->company_id]; Consumable::create($values); $this->tester->seeRecord('consumables', $values); }
public function testAccessoryCategoryAdd() { $category = factory(Category::class, 'accessory-category')->make(); $values = ['name' => $category->name, 'category_type' => $category->category_type]; Category::create($values); $this->tester->seeRecord('categories', $values); }
public function testLostStatuslabelAdd() { $statuslabel = factory(Statuslabel::class, 'lost')->make(); $values = ['name' => $statuslabel->name, 'deployable' => $statuslabel->deployable, 'pending' => $statuslabel->pending, 'archived' => $statuslabel->archived]; Statuslabel::create($values); $this->tester->seeRecord('status_labels', $values); }
public function testCreateWithoutFactory() { $factory = new \WebChemistry\Forms\Factory\Container(); $this->tester->assertExceptionThrown('WebChemistry\\Forms\\FormException', function () use($factory) { $factory->create(); }); }
public function testAssetModelAdd() { $assetmodel = factory(AssetModel::class, 'assetmodel')->make(); $values = ['name' => $assetmodel->name, 'manufacturer_id' => $assetmodel->manufacturer_id, 'category_id' => $assetmodel->category_id, 'eol' => $assetmodel->eol]; AssetModel::create($values); $this->tester->seeRecord('models', $values); }
/** * @return mixed */ public function createPlantWithColorForTest() { $plantID = $this->tester->haveRecord('plants', ['name' => 'test plant']); $colorArray = array("red" => "red", "yellow" => "yellow", "blue" => NULL, "green" => NULL, "brown" => NULL, "black" => NULL, "white" => NULL, "purple" => NULL, "orange" => NULL); $this->UUT->set($plantID, $colorArray); return $plantID; }
public function testWrongTimestamps() { foreach ($this->bad_timestamps as $bad) { $this->modelWValidation->start_date = $bad; $this->tester->assertFalse($this->modelWValidation->save()); } }
public function testSetUnit() { $metric = new Metric(); $this->tester->assertFalse($metric->setUnit('Invalid'), 'Metric::setUnit invalid unit set failed!'); $metric->setUnit('Kilobits/Second'); $this->tester->assertEquals('Kilobits/Second', $metric->getUnit(), 'Metric::setUnit failed!'); }
public function testSupplierAdd() { $supplier = factory(Supplier::class, 'supplier')->make(); $values = ['name' => $supplier->name]; Supplier::create($values); $this->tester->seeRecord('suppliers', $values); }
public function testAccessoryAdd() { $accessory = factory(Accessory::class, 'accessory')->make(); $values = ['name' => $accessory->name, 'category_id' => $accessory->category_id, 'qty' => $accessory->qty]; Accessory::create($values); $this->tester->seeRecord('accessories', $values); }
public function testManufacturerAdd() { $manufacturers = factory(Manufacturer::class, 'manufacturer')->make(); $values = ['name' => $manufacturers->name]; Manufacturer::create($values); $this->tester->seeRecord('manufacturers', $values); }
public function testProcessProlog() { $I = $this->tester; $this->tester->wantToTest("processing the prolog and importing the file into the database"); $this->import->setCsvReader($this->import->file); $this->import->processProlog(); $prolog = $this->import->prolog; $this->assertEquals(14, count($prolog['columns']), "There are the correct number of columns"); $this->assertEquals(6, count($prolog['prefix']), "There are the correct number of prefix entries"); $this->assertEquals(10, count($prolog['meta']), "There are the correct number of meta entries"); $this->import->getDataColumnIds(); $this->import->processData(); $results = $this->import->results['success']; verify( "There were 8 rows processed", count($results['rows']) )->equals(12); $this->import->processParents(); $I->seeRecordCountInDatabaseTable("SchemaPropertyElement", 138); $I->seeRecordCountInDatabaseTable("SchemaProperty", 12); //prolog namespace entries are readable //prolog headers are actually in row 1 //prolog headers not in row 1 produce fatal error (logged) //prolog entries can be matched to database (column uri matched to profile id) //prolog entries that can't be matched produce fatal error (logged) } //
public function testWrongDates() { foreach ($this->bad_dates as $bad) { $this->modelWValidation->date_birth = $bad; $this->tester->assertFalse($this->modelWValidation->save()); } }
public function testAssetAdd() { $asset = factory(Asset::class, 'asset')->make(); $values = ['name' => $asset->name, 'model_id' => $asset->model_id, 'status_id' => $asset->status_id, 'asset_tag' => $asset->asset_tag]; Asset::create($values); $this->tester->seeRecord('assets', $values); }
public function testParseUserName() { $input = $this->markdown->parse('@admin lorem ipsum'); $this->tester->assertRegExp('/<a href=".*">@admin<\\/a> lorem ipsum/', $input); $input = $this->markdown->parse('@admin lorem ipsum `@admin`'); $this->tester->assertRegExp('/<a href=".*">@admin<\\/a> lorem ipsum <code>@admin<\\/code>/', $input); }
public function testNotExists() { $arrayAccess = $this->getArrayAccessor(); $this->tester->assertExceptionThrown('WebChemistry\\Parameters\\ParameterNotExistsException', function () use($arrayAccess) { $arrayAccess['notExists']->asd = NULL; }); }
public function testHasMethod() { $arrayer = new \Mascame\Arrayer\Arrayer([]); $arrayer->set('fruit', 'coconut'); $this->tester->assertTrue($arrayer->has('fruit')); $this->tester->assertFalse($arrayer->has('something-else')); }
public function testDepreciationAdd() { $depreciations = factory(Depreciation::class, 'depreciation')->make(); $values = ['name' => $depreciations->name, 'months' => $depreciations->months]; Depreciation::create($values); $this->tester->seeRecord('depreciations', $values); }
public function testGetRoles() { $this->tester->impersonate('*****@*****.**'); $auth = $this->sm->get('ZfcRbac\\Service\\AuthorizationService'); $i = $auth->getIdentity()->getRoles(); $this->assertTrue($auth->isGranted('Drzava-list')); }
/** * @dataProvider providerDataWithFilePathInValid */ public function testShouldReturnEmptyWHenCheckPostCodeWithFilePathIsNotValid($post_code, $file_path) { //GIVEN //WHEN $results = $this->tester->checkPostCode($post_code, $file_path); //THEN $this->assertFalse($results); }
/** * @dataProvider casesSeverityComparer * * @param int $expected * @param string $a * @param string $b */ public function testSeverityComparer($expected, $a, $b) { $fw = new FileWrapper([]); $class = new ReflectionClass(FileWrapper::class); $severityComparer = $class->getMethod('severityComparer'); $severityComparer->setAccessible(true); $this->tester->assertEquals($expected, $severityComparer->invoke($fw, $a, $b)); }
public function testUserRegistration() { $name = 'Joe Doe'; $email = '*****@*****.**'; $password = bcrypt('password'); User::create(['name' => $name, 'email' => $email, 'password' => $password]); $this->tester->seeRecord('users', ['name' => $name, 'email' => $email, 'password' => $password]); }
/** * @dataProvider providerDctIdInvalid */ public function testShouldReturnFalseWhenGenerateImagePathWithInputDctIDisNotNumber($dctID) { //GIVEN //WHEN $results = $this->tester->generateImagePath($dctID); //THEN $this->assertFalse($results); }
public function testForumDelete() { $this->create(); $before = $this->tester->grabRecord('forums', ['name' => 'B']); Forum::where('name', 'A')->delete(); $after = $this->tester->grabRecord('forums', ['name' => 'B']); $this->assertEquals($before->order - 1, $after->order); }